Skip to content

FastLz: Guard decompression against truncated input (#17000) - #17015

Merged
chrisvest merged 1 commit into
netty:4.1from
chrisvest:4.1-fastlz
Jun 30, 2026
Merged

chrisvest merged 1 commit into
netty:4.1from
chrisvest:4.1-fastlz

Conversation

@chrisvest

Copy link
Copy Markdown
Member

Motivation:

Malformed FastLZ compressed blocks can declare input that is empty or ends in the middle of match metadata. FastLz.decompress should treat these blocks as corrupted input instead of reading past the supplied chunk length.

Modification:

Return 0 for empty compressed input and check the input length before reading optional match length and distance bytes. Add FastLzFrameDecoder regression coverage for empty compressed payloads and truncated match metadata.

Result:

Malformed FastLZ compressed blocks now fail through the decoder as DecompressionException instead of triggering ByteBuf bounds exceptions.

Security impact:

This is not considered a security issue. Malformed compressed input can already cause the decoder to fail the channel, and the previous behavior was a Java ByteBuf bounds exception rather than native memory corruption, data disclosure, or privilege boundary bypass. The change makes the failure mode consistent by treating truncated FastLZ blocks as corrupted input and surfacing the existing DecompressionException path.


Co-authored-by: multicode [email protected]

(cherry picked from commit 775ad71)

Motivation:

Malformed FastLZ compressed blocks can declare input that is empty or
ends in the middle of match metadata. FastLz.decompress should treat
these blocks as corrupted input instead of reading past the supplied
chunk length.

Modification:

Return 0 for empty compressed input and check the input length before
reading optional match length and distance bytes. Add FastLzFrameDecoder
regression coverage for empty compressed payloads and truncated match
metadata.

Result:

Malformed FastLZ compressed blocks now fail through the decoder as
DecompressionException instead of triggering ByteBuf bounds exceptions.

Security impact:

This is not considered a security issue. Malformed compressed input can
already cause the decoder to fail the channel, and the previous behavior
was a Java `ByteBuf` bounds exception rather than native memory
corruption, data disclosure, or privilege boundary bypass. The change
makes the failure mode consistent by treating truncated FastLZ blocks as
corrupted input and surfacing the existing `DecompressionException`
path.

---------

Co-authored-by: multicode <[email protected]>

(cherry picked from commit 775ad71)

@yungs4909-creator yungs4909-creator left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yungs4909-creator

yungs4909-creator commented Jun 29, 2026 via email

Copy link
Copy Markdown

@chrisvest

Copy link
Copy Markdown
Member Author

@yungs4909-creator what are you talking about?

@chrisvest
chrisvest merged commit 7fd5cc7 into netty:4.1 Jun 30, 2026
18 checks passed
@chrisvest
chrisvest deleted the 4.1-fastlz branch June 30, 2026 01:41
lltopk pushed a commit to lltopk/netty that referenced this pull request Oct 24, 2026
…tty#17015)

Motivation:

Malformed FastLZ compressed blocks can declare input that is empty or
ends in the middle of match metadata. FastLz.decompress should treat
these blocks as corrupted input instead of reading past the supplied
chunk length.

Modification:

Return 0 for empty compressed input and check the input length before
reading optional match length and distance bytes. Add FastLzFrameDecoder
regression coverage for empty compressed payloads and truncated match
metadata.

Result:

Malformed FastLZ compressed blocks now fail through the decoder as
DecompressionException instead of triggering ByteBuf bounds exceptions.

Security impact:

This is not considered a security issue. Malformed compressed input can
already cause the decoder to fail the channel, and the previous behavior
was a Java `ByteBuf` bounds exception rather than native memory
corruption, data disclosure, or privilege boundary bypass. The change
makes the failure mode consistent by treating truncated FastLZ blocks as
corrupted input and surfacing the existing `DecompressionException`
path.

---------

Co-authored-by: multicode <[email protected]>

(cherry picked from commit 775ad71)

Co-authored-by: Jonas Konrad <[email protected]>
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.

3 participants