Repository navigation
Conversation
Throw when the value offsets of a Utf8, LargeUtf8, Binary, or LargeBinary column are fewer than length + 1, negative, out of order, or end past the data buffer, instead of reading clamped or overlapping values. AI assistance: Cognition Devin CLI agent (SWE-2 High).
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.
Closes #556.
The IPC reader never compared the value offsets of a variable-width column with its data buffer, or with each other. An offset past the end of the data read the padding bytes after it, and an offset below the one before it made two values overlap:
getVariableWidthBytes()callssubarray(x, y), which clamps the end and returns an empty value wheny < x. Both reads gave corrupt values with no error; Arrow C++ refuses both arrays inArray::ValidateFull().VectorLoadernow checks the offsets ofUtf8,LargeUtf8,Binary, andLargeBinarycolumns when loading a record batch. It throws when the buffer holds fewer thanlength + 1offsets, when the first offset is negative, when an offset is below the one before it, or when the last offset is past the data buffer's length. A first offset above zero stays valid, since a sliced array keeps offsets into its original buffer. This applies to the stream and file readers, compressed batches, and the JSON loader, which share the same visitors. NestedList/Mapoffsets index child vectors rather than a data buffer and are out of scope here.The regression tests patch one value offset inside otherwise valid streams and files written by the real writers — a last offset 8 bytes past the data buffer, an offset below its predecessor, and a negative first offset now raise an error, while empty strings (repeated offsets) and unmodified bytes still read correctly. The open PR #551 validates buffer regions against the message body and does not cover this fault: these offsets are inside their own buffer.
All 3,012 IPC tests across 19 suites passed on
main(7a34e681), along with the ESNext ESM source typecheck and ESLint on both changed files. A full local Jest run was not attempted; on the same machine the suite previously reached its 640 MiB Node heap limit. Upstream CI workflows await maintainer approval and have not run.Cognition Devin CLI agent (SWE-2 High) assisted with the implementation, tests, and verification.