Skip to content

Auto-port 5.0: FastLz: Guard decompression against truncated input - #17004

Merged
yawkat merged 2 commits into
5.0from
auto-port-pr-17000-to-5.0
Jun 29, 2026
Merged

yawkat merged 2 commits into
5.0from
auto-port-pr-17000-to-5.0

Conversation

@netty-project-bot

Copy link
Copy Markdown
Contributor

Auto-port of #17000 to 5.0
Cherry-picked 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.

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)
@yawkat
yawkat enabled auto-merge (squash) June 26, 2026 19:57
@yawkat
yawkat merged commit 3212bc3 into 5.0 Jun 29, 2026
22 of 23 checks passed
@yawkat
yawkat deleted the auto-port-pr-17000-to-5.0 branch June 29, 2026 06:01
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.

2 participants