Conversation
|
Thanks for opening a pull request! This pull request has been automatically closed because you currently have 10 open pull requests, which is more than the limit of 3. Due to the increase in pull requests opened by AI bots, and in order to keep the review queue manageable, Apache Arrow limits contributors without repository access to at most 3 concurrently open pull requests. This helps make sure each pull request gets the attention it needs and that work in progress does not go stale. Once one of your other open pull requests has been merged or closed, you are welcome to reopen this one. See also: |
|
|
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.
Rationale for this change
DictDecoderImpl<ByteArrayType>::SetDictandDictDecoderImpl<FLBAType>::SetDictconcatenate the decoded dictionary values intobyte_array_data_, which is sized from a 64-bittotal_size, but they walk that buffer with a 32-bitoffset. When the concatenated dictionary exceedsINT32_MAXbytes the offset wraps negative andmemcpy(bytes_data + offset, ...)writes outside the allocation. The size is controlled by the dictionary page of an untrusted Parquet file, so aDICTIONARY_PAGEcarrying more than 2 GB of decoded values reachesSetDictand corrupts the heap.What changes are included in this PR?
For FLBA the values are addressed directly as
index * type_lengthand a >2 GB concatenation is valid, so the offset accumulator is widened toint64_t. ForBYTE_ARRAYthe values are exposed through int32 offsets (byte_array_offsets_), so a concatenation pastINT32_MAXcannot be represented; that case now throws instead of wrapping.total_sizewas already 64-bit, so this only closes the narrow accumulator/limit left behind it.Are these changes tested?
Reaching the wrap needs a dictionary page above 2 GB, which is not worth adding as a unit test, so there is no new test. I built
libparquetlocally with the change to confirm it compiles; the valid-input paths are unchanged.Are there any user-facing changes?
A
BYTE_ARRAYdictionary carrying more than 2 GB of data now raises aParquetExceptioninstead of writing out of bounds. WideFIXED_LEN_BYTE_ARRAYdictionaries above 2 GB now decode correctly rather than corrupting memory.This PR contains a "Critical Fix". An untrusted Parquet dictionary page above 2 GB triggers a heap out-of-bounds write through the wrapped 32-bit offset.
Was AI used for this PR?
PR code and description written by:
Reviewed before submission by:
AI tooling helped locate the narrow accumulator and draft this change; I reviewed the patch and verified it builds against the current tree.