Copilot commented on code in PR #51128:
URL: https://github.com/apache/arrow/pull/51128#discussion_r3909024588
##########
cpp/src/parquet/decoder.cc:
##########
@@ -1561,6 +1561,20 @@ class DeltaBitPackDecoder : public
TypedDecoderImpl<DType> {
}
total_values_remaining_ = total_value_count_;
+ // GH-50314: mini_blocks_per_block_ comes from the page header and sizes
the
+ // allocation below, while InitBlock() reads one bit-width byte per
miniblock.
+ // A count larger than the bytes left can never decode, so we reject it
here
+ // instead of allowing it to drive a large allocation. A page holding a
single
+ // value keeps that value in the header and never calls InitBlock(), so
this
Review Comment:
InitHeader still allocates delta_bit_widths_ unconditionally, even when
total_value_count_ == 1 (the “single value in header” case). A corrupt page can
therefore still force a large allocation via mini_blocks_per_block_ without
ever calling InitBlock(). Also, the new bytes_left guard should account for the
mandatory min_delta field (at least 1 byte) and should use a single captured
bytes_left value to avoid mismatches between the comparison and the error
message.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]