Repository navigation
Bound declared object count by a schema-derived minimum record size - #34
Merged
Merged
Conversation
readDataBlock() already rejects a negative object/byte count, but a positive count larger than the payload could actually hold was still accepted at the header, letting a caller's header-only count shortcut report an invented row total instead of erroring. Walk the schema once per file to compute a lower bound on how many bytes a single record can encode to, and reject a block whose declared object count cannot fit in the available bytes for NULL_CODEC (exact payload size) and SNAPPY_CODEC (decompressed eagerly above). Every case the bound can't determine returns 0, which only relaxes the check and never rejects a legitimate file. ZSTD/deflate decompress lazily and are not covered by this check.
PedroTadim
added a commit
that referenced
this pull request
Sep 21, 2026
The test declared a six-long record and then wrote a single uint32_t through it, so the header promised at least six bytes per record over a four-byte payload. Since #34 the reader cross-checks a block's declared object count against the payload it carries, and rejects that file: Object count 1 in block header cannot fit in 4 payload byte(s) for this schema Rejecting it is the check working - the file is internally inconsistent - so fix the test rather than the check. Write a conforming record through the Pair/GenericRecord idiom the rest of the file already uses. All six doc assertions, which are what the test is for, are unchanged. Bisected by running this suite in isolation: it passes at 7b7f6a5 and at f2d65e1 (#33) and fails from 57985a1 (#34) on. Isolation was needed because boost aborts the run at the first fatal error, and an unrelated test0/testWrite segfault on those older commits - fixed since - hides this one. DataFileTests is now 69/69. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
4 tasks
This was referenced Oct 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
readDataBlock() already rejects a negative object/byte count, but a positive count larger than the payload could actually hold was still accepted at the header, letting a caller's header-only count shortcut report an invented row total instead of erroring.
Walk the schema once per file to compute a lower bound on how many bytes a single record can encode to, and reject a block whose declared object count cannot fit in the available bytes for NULL_CODEC (exact payload size) and SNAPPY_CODEC (decompressed eagerly above). Every case the bound can't determine returns 0, which only relaxes the check and never rejects a legitimate file.
ZSTD/deflate decompress lazily and are not covered by this check.
Make sure you have checked all steps below.
Jira
Tests
Commits
Documentation