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

   # Which issue does this PR close?
   
   - Closes #12097
   
   # Rationale for this change
   
   The arrow `DeltaByteArrayDecoder` casts the page's `i32` prefix and suffix 
lengths to `usize` without checking them. On a corrupt page a negative suffix 
length becomes a huge `usize`, `data_offset + suffix_length` wraps in release 
builds, the bounds check passes and the slice panics. #9796 fixed the same 
thing for the decoder in `encodings/decoding.rs`.
   
   # What changes are included in this PR?
   
   - `DeltaByteArrayDecoder::new` returns an error if any prefix or suffix 
length is negative.
   - `read` and `skip` compute the end offset with `checked_add`, so the bounds 
check can't wrap.
   
   # Are these changes tested?
   
   Yes, two unit tests build pages with a negative prefix and a negative suffix 
length and check that `new` returns an error.
   
   # Are there any significant user-facing changes?
   
   No. Corrupt pages that used to panic now return an error.
   
   ---
   
   AI disclosure: the patch and tests were drafted with AI assistance (Claude); 
I reviewed every line and ran fmt, clippy and the parquet decoder tests.
   


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