fix bits::copyBits coredump caused by negative leafNullsSize_#529
Merged
Conversation
9007827 to
6082828
Compare
1cc2297 to
456000f
Compare
fzhedu
reviewed
May 11, 2026
| leafNulls_.data(), | ||
| 0); | ||
| numRowsInPage_ = leafNullsSize_; | ||
| numRowsInPage_ = checkedInt64ToInt32(leafNullsSize_, "leafNullsSize_"); |
Collaborator
There was a problem hiding this comment.
why can't numRowsInPage_ be int64?
Collaborator
Author
Collaborator
There was a problem hiding this comment.
why not put checkedInt64ToInt32 in getLengthsAndNulls for specific code path, not narrow int type outside.
fzhedu
reviewed
May 11, 2026
fzhedu
reviewed
May 11, 2026
b62c140 to
11d371a
Compare
fzhedu
reviewed
May 12, 2026
Comment on lines
284
to
+293
| @@ -290,13 +290,14 @@ void PageReader::readPageDefLevels() { | |||
| nullptr, | |||
| leafNulls_.data(), | |||
| 0); | |||
| numRowsInPage_ = leafNullsSize_; | |||
| leafNullsSize_ = numRowsInPage_; | |||
Collaborator
There was a problem hiding this comment.
why change the position of them?
Collaborator
Author
There was a problem hiding this comment.
getLengthsAndNulls is int32_t, leafNullsSize_ is int64_t, no need to cast
| void PageReader::updateRowInfoAfterPageSkipped() { | ||
| rowOfPage_ += numRowsInPage_; | ||
| if (hasChunkRepDefs_) { | ||
| BOLT_CHECK_GE(rowOfPage_, 0); |
Collaborator
There was a problem hiding this comment.
use __builtin_add_overflow for rowOfPage_ ?
Collaborator
Author
There was a problem hiding this comment.
A compiler-specific builtin does not seem necessary here, since it would not provide much practical benefit for this case.
11d371a to
10b62e5
Compare
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.

Issue Number: close #528
Type of Change
Description
Fix bits::copyBits coredump caused by leafNullsSize_ overflow. This PR upgrades the type of leafNullsSize_ from
int32_ttoint64_tto eliminate integer overflow risks.Performance Impact
No Impact: This change does not affect the critical path (e.g., build system, doc, error handling).
Positive Impact: I have run benchmarks.
Click to view Benchmark Results
Negative Impact: Explained below (e.g., trade-off for correctness).
Release Note
Please describe the changes in this PR
Release Note:
Checklist (For Author)
Breaking Changes
No
Yes (Description: ...)
Click to view Breaking Changes