Skip to content

fix sign extension when decoding Backward Size#25

Open
aizu-m wants to merge 1 commit into
tukaani-project:masterfrom
aizu-m:backwardsize-sign-extension
Open

fix sign extension when decoding Backward Size#25
aizu-m wants to merge 1 commit into
tukaani-project:masterfrom
aizu-m:backwardsize-sign-extension

Conversation

@aizu-m
Copy link
Copy Markdown

@aizu-m aizu-m commented Jun 1, 2026

Backward Size is an unsigned 32-bit field, but decodeStreamFooter ORs each byte into a long without widening, so a most-significant byte >= 0x80 makes the int shift sign-extend and yields a negative backwardSize. That value slips past the backwardSize >= pos check in SeekableXZInputStream and leads to an out-of-range seek. Widen the byte to long before shifting, like uncompSize in LZMAInputStream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant