Skip to content

test: seeded fuzz for every format; two reader fixes it found - #40

Merged
vaceslav merged 5 commits into
mainfrom
test/fuzz
Sep 27, 2026
Merged

vaceslav merged 5 commits into
mainfrom
test/fuzz

Conversation

@vaceslav

Copy link
Copy Markdown
Contributor

Part of #16, item 2.

Seeded fuzz tests under tests/TriasDev.Tabular.Tests/Fuzz:

  • csv: random tables in every delimiter, line ending, encoding (UTF-8 with and without BOM, UTF-16 LE) and quoting RFC 4180 allows, read back cell for cell with no repairs; plain tables have their dialect found.
  • xlsx: shared and inline strings, rich-text runs, phonetic runs, entities, character references, CDATA, formula strings, omitted cell and row references, date styles, the 1904 epoch, several sheets.
  • ods: repeated cells and rows, paragraphs, text:s / text:tab / text:line-break, spans, annotations, stated string values, covered cells, header rows, errors.
  • mangled input: csv byte soup and workbooks whose package parts are cut, doubled or salted with hostile tokens are read or refused with a TabularException, never anything else and never a hang.

Seeded and a few hundred cases each by default (about 1.5 s together). TABULAR_FUZZ_CASES, TABULAR_FUZZ_SEED and TABULAR_FUZZ_DUMP are documented in CONTRIBUTING. 20 000 cases per test pass locally, and 100 000 for the csv round trip.

Two reader fixes the fuzz found, each with a named test that failed first:

  • fix(csv): the stray-quote rule (csv: a legitimate quoted field longer than four lines is split #10, Quote pairs across lines join records silently (valid RFC 4180, wrong for the data) #20) caught a legitimate quoted value that holds a record's worth of delimiters and a line break, even when reading the quote as stray would leave its line with more fields than a record. That line would overfill the record, so the quote must be real, and the value now stands. A value whose stray reading does fit the record is still, deliberately, read as a stray quote; the generator keeps clear of that case, which is ambiguous byte for byte.
  • fix(xlsx): text that follows a CDATA section in a <v> was dropped (<v><![CDATA[4]]>2</v> read as 4). The scanner now tells the value reader that the text goes on.

Checked against the local real-file corpus (11 csv files, including the 5M-row malformed one, and 4 large workbooks): every read fingerprint and repair count matches main, and timings are within noise.

@vaceslav
vaceslav merged commit 8a453f0 into main Sep 27, 2026
9 checks passed
@vaceslav
vaceslav deleted the test/fuzz branch September 27, 2026 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant