ORC-2191: Reject overflowing PostScript tail lengths in ReaderImpl#2672
Draft
dongjoon-hyun wants to merge 1 commit into
Draft
ORC-2191: Reject overflowing PostScript tail lengths in ReaderImpl#2672dongjoon-hyun wants to merge 1 commit into
dongjoon-hyun wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
This PR validates the PostScript tail lengths in
ReaderImpl.extractFileTailbefore they are castfrom
longtoint, throwingFileFormatExceptionwhenfooterLength,metadataLength,stripeStatisticsLength, or their sum is negative or exceeds the file length /Integer.MAX_VALUE.It is the Java counterpart of the C++ overflow checks in ORC-2167.
Why are the changes needed?
These fields are protobuf
uint64read as Javalong. A malformed value nearUINT64_MAXor above2GB would truncate/overflow on the
intcast into a bogus offset or allocation size instead of aclear error. Per the ORC threat model this is a fail-fast robustness fix, not a CVE.
How was this patch tested?
Added
TestReaderImpl.testMalformedTailLengthOverflow, which crafts files with tail lengths of2^31,2^32, andUINT64_MAXand assertsOrcFile.createReaderthrowsFileFormatException.Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Fable 5