amitcoder79 opened a new pull request, #12132:
URL: https://github.com/apache/arrow-rs/pull/12132

   # Which issue does this PR close?
   
   Closes #12099
   
   # Rationale
   
   `read_vlq` loops until it reads a byte without the continuation bit, with no 
upper bound on the number of bytes consumed. A 64-bit Thrift compact varint 
uses at most 10 bytes (`ceil(64/7)`). On the 11th byte, `wrapping_shl` turns a 
shift of 70 bits into a shift of 6 bits, silently ORing the payload into the 
low bits and corrupting the decoded value.
   
   The issue provides a reproducer where a 15-byte varint causes 
`decode_metadata` to read the file version as 33 instead of 1.
   
   # What changes are included in this PR?
   
   Added a `shift > 63` check in the `read_vlq` loop that returns a new 
`ThriftProtocolError::InvalidVlq` error, matching the protobuf and Thrift 
compact protocol varint specifications. The error converts to 
`ParquetError::General("varint exceeds 10 bytes")`.
   
   # Are there any user-facing changes?
   
   Malformed Thrift varints that previously decoded silently with wrong values 
now return an error. This is a correctness improvement — no valid file should 
contain varints longer than 10 bytes.


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

Reply via email to