Skip to content

Auto-port 4.1: Snappy: Guard decoder against invalid chunk lengths - #17110

Merged
chrisvest merged 1 commit into
4.1from
auto-port-pr-17099-to-4.1
Jul 22, 2026
Merged

chrisvest merged 1 commit into
4.1from
auto-port-pr-17099-to-4.1

Conversation

@netty-project-bot

Copy link
Copy Markdown
Contributor

Auto-port of #17099 to 4.1
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 8b6eb02 into 4.1 Jul 22, 2026
19 checks passed
@chrisvest
chrisvest deleted the auto-port-pr-17099-to-4.1 branch July 22, 2026 22:16
lltopk pushed a commit to lltopk/netty that referenced this pull request Oct 24, 2026
…etty#17110)

Auto-port of netty#17099 to 4.1
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

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