Skip to content

COMPRESS-733: Stop at the end of the stream in a back reference's length code - #844

Open
Marti2203 wants to merge 1 commit into
apache:masterfrom
Marti2203:implode-truncated-length
Open

Marti2203 wants to merge 1 commit into
apache:masterfrom
Marti2203:implode-truncated-length

Conversation

@Marti2203

Copy link
Copy Markdown

Fixes COMPRESS-733.

When an imploded (method 6) entry ends inside the length code of a back reference, ExplodingInputStream.fillBuffer() used the -1 from lengthTree.read(bits) as a length and copied one byte from the still empty dictionary. This returns there, as the literal and distance branches already do.

ExplodingInputStreamTest.testTruncatedBackReferenceLength decodes such a stream; it gets 1 byte without the change and 0 with it. mvn -B -DskipTests -DskipITs passes.

This issue was found by an LLM-Enhanced Static Analysis Engine and verified manually. The patch and this description were prepared with AI assistance (Claude Code) and reviewed by me; the commit carries an Assisted-By: trailer.

…gth code

ExplodingInputStream.fillBuffer() treated -1 from the length tree as a
length, copying a byte from the empty dictionary when an imploded entry
ends inside the length code of a back reference. Return as the literal
and distance branches already do.

Assisted-By: Claude Code:claude-opus-5-5
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