Repository navigation
Cap row counts at SIZE_MAX on 32-bit targets - #36
Merged
Merged
Conversation
CHC_MAX_NUM_ROWS defaults to 10^12, above SIZE_MAX on 32-bit targets, so block row counts, Array totals & LowCardinality dictionary sizes between 2^32 & 10^12 passed the check & were then narrowed to size_t. An Array(UInt8) row whose offset is 2^32 + 1 decoded 1 nested value while its offset still claimed 2^32 + 1, & a block declaring 2^32 + 1 rows came back with 1 row & no error. Clamp the default to SIZE_MAX, & reject an override that exceeds it.
serprex
reviewed
Nov 22, 2026
| test_rows_past_size_t(void) | ||
| { | ||
| current_test = "rows_past_size_t"; | ||
| #if SIZE_MAX < UINT64_MAX |
Member
There was a problem hiding this comment.
since CI doesn't run on 32b it's fine to omit this test
serprex
approved these changes
Nov 22, 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.
CHC_MAX_NUM_ROWS defaults to 10^12, which is above SIZE_MAX on 32-bit targets. Block row counts, Array totals and LowCardinality dictionary sizes between 2^32 and 10^12 pass the check and are then cast to size_t.
On i386, an Array(UInt8) row whose offset is 2^32 + 1 decodes one nested value, but its offset still says 2^32 + 1. A caller walking the offsets reads past the nested column. A block that declares 2^32 + 1 rows comes back with 1 row and no error.
The default is now clamped to SIZE_MAX, and an #error rejects an override that doesn't fit size_t. 64-bit builds keep 10^12.