Skip to content

Honor maxAllocation for brotli in DelegatingDecompressorFrameListener - #17866

Merged
normanmaurer merged 1 commit into
netty:4.2from
yawkat:http2-brotli-max-allocation
Oct 16, 2026
Merged

normanmaurer merged 1 commit into
netty:4.2from
yawkat:http2-brotli-max-allocation

Conversation

@yawkat

@yawkat yawkat commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Motivation:
DelegatingDecompressorFrameListener documents maxAllocation as the maximum
size of the decompression buffer. For gzip, deflate and zstd it is passed to
the output limit of the decoder, but for br it is passed to
new BrotliDecoder(maxAllocation), whose argument is the input buffer size.
The output buffer size of the BrotliDecoder therefore stays at its 64 KiB
default, regardless of the configured maxAllocation.

This is the same bug as #17034, which was fixed for HttpContentDecompressor
in #17037, but not for HTTP/2.

Modification:

  • Create the BrotliDecoder with BrotliDecoder.newDecoderWithMaxAllocation,
    like HttpContentDecompressor does.
  • Add a test that checks that decompressed br data is forwarded in chunks no
    larger than maxAllocation.

Result:
maxAllocation is honored for brotli-encoded HTTP/2 content.

Discovered by fuzzing.

🤖 Generated with Claude Code

Motivation:
DelegatingDecompressorFrameListener documents maxAllocation as the maximum
size of the decompression buffer. For gzip, deflate and zstd it is passed to
the output limit of the decoder, but for br it is passed to
new BrotliDecoder(maxAllocation), whose argument is the input buffer size.
The output buffer size of the BrotliDecoder therefore stays at its 64 KiB
default, regardless of the configured maxAllocation.

This is the same bug as netty#17034, which was fixed for HttpContentDecompressor
in netty#17037, but not for HTTP/2.

Modification:
- Create the BrotliDecoder with BrotliDecoder.newDecoderWithMaxAllocation,
  like HttpContentDecompressor does.
- Add a test that checks that decompressed br data is forwarded in chunks no
  larger than maxAllocation.

Result:
maxAllocation is honored for brotli-encoded HTTP/2 content.

Discovered by fuzzing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@yawkat yawkat added found by fuzzing needs-cherry-pick-4.1 This PR should be cherry-picked to 4.1 once merged. needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. labels Oct 16, 2026
@yawkat
yawkat marked this pull request as ready for review October 16, 2026 10:33
@testlens-app

testlens-app Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

🚨 TestLens detected 2 failed tests 🚨

Failed Jobs without Test Failures

❌ Build PR / linux-x86_64-java21-graal build

Test Summary

Tip

Inspect all details with the TestLens CLI: testlens pr 17866

Build PR / linux-x86_64-java11-boringssl build > Netty/Testsuite/JPMS

Test Runs Flakiness
OCSPTest > testSimpleQueryTest() ❌ 0% 🟢

Build PR / macos-aarch64-java11-boringssl build > Netty/Transport/Native/KQueue

Test Runs Flakiness
KQueueDatagramUnicastIPv6MappedTest > testSimpleSendCompositeDirectByteBuf(TestInfo) ❌ 2% 🟡

🏷️ Commit: ae6fb1d
▶️ Tests: 55374 executed
🟡 Checks: 31/35 completed

Test Failures

OCSPTest > testSimpleQueryTest() (Netty/Testsuite/JPMS in Build PR / linux-x86_64-java11-boringssl build)
org.opentest4j.AssertionFailedError: expected: <true> but was: <false>
	at [email protected]/org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at [email protected]/org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at [email protected]/org.junit.jupiter.api.AssertTrue.failNotTrue(AssertTrue.java:63)
	at [email protected]/org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:36)
	at [email protected]/org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:31)
	at [email protected]/org.junit.jupiter.api.Assertions.assertTrue(Assertions.java:183)
	at io.netty.testsuite_jpms.test/io.netty.testsuite_jpms.test.OCSPTest.testSimpleQueryTest(OCSPTest.java:92)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
expected actual
true false
KQueueDatagramUnicastIPv6MappedTest > testSimpleSendCompositeDirectByteBuf(TestInfo) (Netty/Transport/Native/KQueue in Build PR / macos-aarch64-java11-boringssl build)
org.opentest4j.AssertionFailedError
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSend0(DatagramUnicastTest.java:368)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSend(DatagramUnicastTest.java:194)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSendCompositeDirectByteBuf(DatagramUnicastTest.java:128)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest$3.run(DatagramUnicastTest.java:114)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest$3.run(DatagramUnicastTest.java:111)
	at io.netty.testsuite.transport.AbstractComboTestsuiteTest.run(AbstractComboTestsuiteTest.java:52)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSendCompositeDirectByteBuf(DatagramUnicastTest.java:111)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)

Rerun Controls

Note

Checks are currently running using the configuration below.

Select tests to mute in this pull request:

🔲 KQueueDatagramUnicastIPv6MappedTest > testSimpleSendCompositeDirectByteBuf(TestInfo)
🔲 OCSPTest > testSimpleQueryTest()

Reuse successful test results:

🔲 ♻️ Only rerun the tests that failed or were muted before

Click the checkbox to trigger a rerun:

🔲 Rerun jobs


Learn more about TestLens at testlens.app/docs.

@normanmaurer normanmaurer added this to the 4.2.20.Final milestone Oct 16, 2026
@normanmaurer
normanmaurer merged commit 46ee86b into netty:4.2 Oct 16, 2026
30 of 33 checks passed
@netty-project-bot

Copy link
Copy Markdown
Contributor

Could not create auto-port PR.
Got conflicts when cherry-picking onto 4.1.

@normanmaurer

Copy link
Copy Markdown
Member

Port for 4.1 #17881

normanmaurer pushed a commit that referenced this pull request Oct 16, 2026
…meListener (#17866)

Motivation:
DelegatingDecompressorFrameListener documents maxAllocation as the
maximum
size of the decompression buffer. For gzip, deflate and zstd it is
passed to
the output limit of the decoder, but for br it is passed to
new BrotliDecoder(maxAllocation), whose argument is the input buffer
size.
The output buffer size of the BrotliDecoder therefore stays at its 64
KiB
default, regardless of the configured maxAllocation.

This is the same bug as #17034, which was fixed for
HttpContentDecompressor
in #17037, but not for HTTP/2.

Modification:
- Create the BrotliDecoder with
BrotliDecoder.newDecoderWithMaxAllocation,
  like HttpContentDecompressor does.
- Add a test that checks that decompressed br data is forwarded in
chunks no
  larger than maxAllocation.

Result:
maxAllocation is honored for brotli-encoded HTTP/2 content.

Discovered by fuzzing.
@netty-project-bot

Copy link
Copy Markdown
Contributor

Auto-port PR for 5.0: #17883

@github-actions github-actions Bot removed the needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. label Oct 16, 2026
normanmaurer pushed a commit that referenced this pull request Oct 16, 2026
…orFrameListener (#17883)

Auto-port of #17866 to 5.0
Cherry-picked commit: 46ee86b

---
Motivation:
DelegatingDecompressorFrameListener documents maxAllocation as the
maximum
size of the decompression buffer. For gzip, deflate and zstd it is
passed to
the output limit of the decoder, but for br it is passed to
new BrotliDecoder(maxAllocation), whose argument is the input buffer
size.
The output buffer size of the BrotliDecoder therefore stays at its 64
KiB
default, regardless of the configured maxAllocation.

This is the same bug as #17034, which was fixed for
HttpContentDecompressor
in #17037, but not for HTTP/2.

Modification:
- Create the BrotliDecoder with
BrotliDecoder.newDecoderWithMaxAllocation,
  like HttpContentDecompressor does.
- Add a test that checks that decompressed br data is forwarded in
chunks no
  larger than maxAllocation.

Result:
maxAllocation is honored for brotli-encoded HTTP/2 content.

Discovered by fuzzing.

Co-authored-by: Jonas Konrad <[email protected]>
@normanmaurer normanmaurer removed the needs-cherry-pick-4.1 This PR should be cherry-picked to 4.1 once merged. label Oct 16, 2026
ikpil added a commit to ikpil/Netty.NET that referenced this pull request Nov 29, 2026
…ameListener (netty/netty#17866)

Motivation:
DelegatingDecompressorFrameListener documents maxAllocation as the
maximum
size of the decompression buffer. For gzip, deflate and zstd it is
passed to
the output limit of the decoder, but for br it is passed to
new BrotliDecoder(maxAllocation), whose argument is the input buffer
size.
The output buffer size of the BrotliDecoder therefore stays at its 64
KiB
default, regardless of the configured maxAllocation.

This is the same bug as netty/netty#17034, which was fixed for
HttpContentDecompressor
in netty/netty#17037, but not for HTTP/2.

Modification:
- Create the BrotliDecoder with
BrotliDecoder.newDecoderWithMaxAllocation,
  like HttpContentDecompressor does.
- Add a test that checks that decompressed br data is forwarded in
chunks no
  larger than maxAllocation.

Result:
maxAllocation is honored for brotli-encoded HTTP/2 content.

Discovered by fuzzing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants