dongjoon-hyun opened a new pull request, #2681:
URL: https://github.com/apache/orc/pull/2681

   ### What changes were proposed in this pull request?
   
   This PR aims to validate each stream's `offset + length` against the stripe 
data boundary in the Java `StripePlanner`, throwing `FileFormatException` when 
a stream overflows or exceeds the stripe's index+data region.
   
   ### Why are the changes needed?
   
   This closes a C++/Java reader parity gap. The C++ reader already rejects 
such streams in `StripeStreamsImpl::getStream` by computing `dataEnd = 
stripeOffset + indexLength + dataLength`, while the Java 
`StripePlanner.handleStream` accumulated `currentOffset += stream.getLength()` 
with no bound check. Since `stream.getLength()` is an untrusted protobuf 
`uint64`, a crafted stripe footer could drive reads outside the stripe region.
   
   ### How was this patch tested?
   
   Pass the CIs with the newly added `TestStripePlanner`:
   - `testStreamLengthExceedsStripeBoundary`: a stream whose length exceeds the 
stripe boundary is rejected with `FileFormatException`.
   - `testWellFormedStripePlans`: a well-formed stripe still plans correctly.
   
   Also verified `TestRecordReaderImpl`, `TestSchemaEvolution`, and 
`TestVectorOrcFile` stay green.
   
   Generated-by: Claude Opus 4.8


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