Skip to content

Auto-port 5.0: Snappy: Guard decoder against invalid chunk lengths - #17109

Merged
chrisvest merged 2 commits into
5.0from
auto-port-pr-17099-to-5.0
Jul 22, 2026
Merged

chrisvest merged 2 commits into
5.0from
auto-port-pr-17099-to-5.0

Conversation

@netty-project-bot

Copy link
Copy Markdown
Contributor

Auto-port of #17099 to 5.0
Cherry-picked commit: b41f2a6


Motivation:

Malformed Snappy framed input can declare compressed or uncompressed chunk lengths that are too short to contain the mandatory masked checksum. In the compressed case this can lead to lower-level ByteBuf index errors instead of a DecompressionException.

Modification:

Validate minimum chunk lengths in SnappyFrameDecoder before reading the checksum or Snappy preamble. Added parameterized tests that cover invalid compressed and uncompressed chunk lengths with checksum validation both enabled and disabled.

Result:

Malformed Snappy chunks with invalid lengths are rejected with DecompressionException.

Verification:

./mvnw -pl codec-compression -am -Dtest=SnappyFrameDecoderTest -Dsurefire.failIfNoSpecifiedTests=false test -DskipNativeTests -DskipAutobahnTests

Motivation:

Malformed Snappy framed input can declare compressed or uncompressed
chunk lengths that are too short to contain the mandatory masked
checksum. In the compressed case this can lead to lower-level ByteBuf
index errors instead of a DecompressionException.

Modification:

Validate minimum chunk lengths in SnappyFrameDecoder before reading the
checksum or Snappy preamble. Added parameterized tests that cover
invalid compressed and uncompressed chunk lengths with checksum
validation both enabled and disabled.

Result:

Malformed Snappy chunks with invalid lengths are rejected with
DecompressionException.

Verification:

./mvnw -pl codec-compression -am -Dtest=SnappyFrameDecoderTest
-Dsurefire.failIfNoSpecifiedTests=false test -DskipNativeTests
-DskipAutobahnTests

---------

Co-authored-by: multicode <[email protected]>
(cherry picked from commit b41f2a6)
@chrisvest chrisvest added this to the 5.0.0.Final milestone Jul 22, 2026
@chrisvest
chrisvest merged commit 479e89e into 5.0 Jul 22, 2026
13 checks passed
@chrisvest
chrisvest deleted the auto-port-pr-17099-to-5.0 branch July 22, 2026 22:15
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.

4 participants