Repository navigation
Conversation
…dation The minimum buffer sizes and the fixed-size list child length were computed by multiplying offset + length without an overflow check, so a huge length could wrap around to a small size and pass validation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pedrobtz
force-pushed
the
fix-validate-size-overflow
branch
from
October 22, 2026 15:27
2958d30 to
c5f84db
Compare
This branch has not been deployed
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.
ArrowArrayViewValidateMinimal()checks thatoffset + lengthfits anint64_t, then multiplies it by the element size to get each buffer's minimum size. For a fixed-size list it multiplies by the list size to get the child's minimum length. Neither product is checked. A large length overflows the product, which is undefined behaviour. In practice it wraps, and can wrap to a small size that then passes. For anint32array of length 2^62 + 1,32 * 4611686018427387905overflows. Without this change, validation returnsNANOARROW_OKwith a 16-byte data buffer.The length is now checked against each buffer's element size in bits before any size is computed, with room for the round-up to whole bytes. It is also checked against the list size before the fixed-size list child length is computed. Lengths that fit behave as before.
The new
ArrayViewTestBufferSizeOverflowtest validates both cases at the minimal level and expectsEINVAL. Without the fix, UBSan reports the overflow and the int32 case returnsNANOARROW_OK.Found by fuzzing the IPC reader in the zuarrow R package, which vendors nanoarrow. An IPC field node can declare any length, and
ArrowIpcArrayStreamReaderreached this overflow at full validation.ctestpasses in a plain Debug build and with ASan and UBSan (410 tests each). The changed files are formatted with the pinned clang-format 16.0.6.🤖 Generated with Claude Code