github-actions[bot] commented on code in PR #63509:
URL: https://github.com/apache/doris/pull/63509#discussion_r3285622371


##########
be/src/format/parquet/byte_array_plain_decoder.cpp:
##########
@@ -33,7 +33,7 @@ Status ByteArrayPlainDecoder::skip_values(size_t num_values) {
         uint32_t length =
                 decode_fixed32_le(reinterpret_cast<const 
uint8_t*>(_data->data) + _offset);
         _offset += 4;
-        if (UNLIKELY(_offset + length) > _data->size) {
+        if (UNLIKELY(cast_set<uint64_t>(_offset + length) > _data->size)) {

Review Comment:
   This still overflows before the cast: `_offset` and `length` are both 
`uint32_t`, so a malformed value such as `_offset = 8` and `length = 
UINT32_MAX` wraps in `_offset + length` before `cast_set<uint64_t>` sees it. 
That can pass the bounds check and then skip/read outside the Slice. Cast one 
operand before adding, or compare with subtraction such as `length > 
_data->size - _offset`. The same pattern appears in the two decode paths below.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to