GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Http2: reject generic frames whose payload exceeds SETTINGS_MAX_FRAME_SIZE by AbhishekShukla1289 · Pull Request #17779 · netty/netty

Conversation

@AbhishekShukla1289

@AbhishekShukla1289 AbhishekShukla1289 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Motivation:

RFC 9113 Section 4.2 applies SETTINGS_MAX_FRAME_SIZE to the payload
of every frame. The typed writers in DefaultHttp2FrameWriter honour
the limit advertised by the remote peer: writeData splits large
payloads into multiple DATA frames and writeHeaders uses CONTINUATION.
The generic writeFrame(...) path does not check the limit and writes
the full payload length into a single frame header, so it can emit a
frame that a compliant peer must reject with FRAME_SIZE_ERROR.

Modification:

  • Verify the payload length against maxFrameSize in writeFrame before
    allocating the frame header. A generic frame has unknown semantics
    and cannot be split, so the write fails instead: the payload is
    released and the promise is failed with an IllegalArgumentException,
    consistent with the other verify* checks in this class.
  • Add tests for a payload of maxFrameSize + 1 (rejected, nothing
    written, payload released) and of exactly maxFrameSize (written).
    The first fails without the change and passes with it.

Result:

Generic frames can no longer exceed the frame size negotiated with
the remote peer. codec-http2 tests: 1633, 0 failures.

Fixes #17426

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
netty-project-bot added 2 commits October 9, 2026 00:44
@netty-project-bot @AbhishekShukla1289
HTTP/2: Reject generic frames whose payload exceeds SETTINGS_MAX_FRAM…
6fe372c
…E_SIZE

Motivation:

RFC 9113 Section 4.2 applies SETTINGS_MAX_FRAME_SIZE to the payload
of every frame. The typed writers in DefaultHttp2FrameWriter honour
the limit advertised by the remote peer: writeData splits large
payloads into multiple DATA frames and writeHeaders uses CONTINUATION.
The generic writeFrame(...) path does not check the limit and writes
the full payload length into a single frame header, so it can emit a
frame that a compliant peer must reject with FRAME_SIZE_ERROR.

Modification:

- Verify the payload length against maxFrameSize in writeFrame before
  allocating the frame header. A generic frame has unknown semantics
  and cannot be split, so the write fails instead: the payload is
  released and the promise is failed with an IllegalArgumentException,
  consistent with the other verify* checks in this class.
- Add tests for a payload of maxFrameSize + 1 (rejected, nothing
  written, payload released) and of exactly maxFrameSize (written).
  The first fails without the change and passes with it.

Result:

Generic frames can no longer exceed the frame size negotiated with
the remote peer. codec-http2 tests: 1633, 0 failures.

Fixes netty#17426
@netty-project-bot @AbhishekShukla1289
HTTP/2: Reject generic frames whose payload exceeds SETTINGS_MAX_FRAM…
5906d7c
…E_SIZE

Motivation:

RFC 9113 Section 4.2 applies SETTINGS_MAX_FRAME_SIZE to the payload
of every frame. The typed writers in DefaultHttp2FrameWriter honour
the limit advertised by the remote peer: writeData splits large
payloads into multiple DATA frames and writeHeaders uses CONTINUATION.
The generic writeFrame(...) path does not check the limit and writes
the full payload length into a single frame header, so it can emit a
frame that a compliant peer must reject with FRAME_SIZE_ERROR.

Modification:

- Verify the payload length against maxFrameSize in writeFrame before
  allocating the frame header. A generic frame has unknown semantics
  and cannot be split, so the write fails instead: the payload is
  released and the promise is failed with an IllegalArgumentException,
  consistent with the other verify* checks in this class.
- Add tests for a payload of maxFrameSize + 1 (rejected, nothing
  written, payload released) and of exactly maxFrameSize (written).
  The first fails without the change and passes with it.

Result:

Generic frames can no longer exceed the frame size negotiated with
the remote peer. codec-http2 tests: 1633, 0 failures.

This change was drafted with AI assistance; I reviewed, tested, and
verified it locally.

Fixes netty#17426
@normanmaurer normanmaurer added this to the 4.2.20.Final milestone Oct 14, 2026
@normanmaurer normanmaurer added 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 14, 2026
@normanmaurer

normanmaurer commented Oct 14, 2026

Copy link
Copy Markdown
Member

@AbhishekShukla1289 Please sign our ICLa and let me know once done: https://netty.io/s/icla

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bryce-anderson
bryce-anderson approved these changes Oct 14, 2026
View reviewed changes

@bryce-anderson bryce-anderson left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Approved because this is definitely a step forward but I'd love it if you sealed off the other two cases that remain open.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2FrameWriter.java Outdated
}
}

private void verifyPayloadLength(int payloadLength) {

@bryce-anderson bryce-anderson Oct 14, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

It would be nice to include the frame type in the message, especially if you use this for other frame types.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

normanmaurer reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2FrameWriter.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2FrameWriter.java
verifyStreamOrConnectionId(lastStreamId, "Last Stream ID");
verifyErrorCode(errorCode);

int payloadLength = 8 + debugData.readableBytes();

@bryce-anderson bryce-anderson Oct 14, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

What do you think about truncating the payload if it exceeds the max frame size? If it were another frame, I'd suggest we reject it, but a GOAWAY feels like a must send type of frame so a warning that the debug data was truncated and then truncate feels like the right thing to do here.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

normanmaurer reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@normanmaurer normanmaurer Oct 14, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

+1 to what @bryce-anderson suggested

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@normanmaurer

normanmaurer commented Oct 14, 2026

Copy link
Copy Markdown
Member

@AbhishekShukla1289 please address @bryce-anderson comments

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer
Merge branch '4.2' into fix-17426-generic-frame-max-size
9b39359
@AbhishekShukla1289

AbhishekShukla1289 commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

@normanmaurer I've signed the ICLA. Working on @bryce-anderson's review comments now.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

AbhishekShukla1289 added 2 commits October 19, 2026 14:37
@AbhishekShukla1289
Merge branch 'fix-17426-generic-frame-max-size' of https://github.com…
1bb0f5c
…/AbhishekShukla1289/netty into fix-17426-generic-frame-max-size
@AbhishekShukla1289
Address review: include frame type in message, check SETTINGS size, t…
e612689
…runcate GOAWAY debug data
@AbhishekShukla1289

AbhishekShukla1289 commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @bryce-anderson and @normanmaurer! Pushed an update: the error message now includes the frame type, writeSettings validates its payload length, and writeGoAway truncates oversized debug data to maxFrameSize - 8 with a warning instead of rejecting. Added tests for both new cases.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AbhishekShukla1289

AbhishekShukla1289 commented Oct 19, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Some notes on the update:

  • GOAWAY: I take a retained slice and release the original instead of touching the caller's writerIndex. maxFrameSize is at least 16384, so maxFrameSize - 8 can't go negative.
  • SETTINGS: rejecting instead of splitting, since each SETTINGS frame gets its own ACK and splitting would change what a single update means.
  • Also checked the other writers. DATA splits, HEADERS/PUSH_PROMISE use CONTINUATION, and the fixed-size frames are way under the minimum. So I think everything in DefaultHttp2FrameWriter is covered now.

Quick q: I went with warn for the truncation log. Would debug be better so busy servers don't get spammed?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AbhishekShukla1289
AbhishekShukla1289 requested review from bryce-anderson and normanmaurer October 19, 2026 22:51
bryce-anderson
bryce-anderson reviewed Oct 20, 2026
View reviewed changes

@bryce-anderson bryce-anderson left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

One last nit. Thank you!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2FrameWriter.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@AbhishekShukla1289 @bryce-anderson
Update codec-http2/src/main/java/io/netty/handler/codec/http2/Default…
a5eae0b
…Http2FrameWriter.java

Co-authored-by: Bryce Anderson <[email protected]>
normanmaurer
normanmaurer approved these changes Oct 21, 2026
View reviewed changes
@normanmaurer
Merge branch '4.2' into fix-17426-generic-frame-max-size
916ef18
@testlens-app

testlens-app Bot commented Oct 21, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

🚨 TestLens detected 1 failed test 🚨

Test Summary

Tip

Inspect all details with the TestLens CLI: testlens pr 17779

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

Test Runs Flakiness
KQueueDatagramUnicastIPv6MappedTest > testSimpleSendWithConnect(TestInfo) 🚫 ❌ 3% 🟡

🏷️ Commit: 916ef18
▶️ Tests: 55897 executed
⚪️ Checks: 26/26 completed

Test Failures

KQueueDatagramUnicastIPv6MappedTest > testSimpleSendWithConnect(TestInfo) (Netty/Transport/Native/KQueue in Build PR / macos-aarch64-java11-boringssl build)
org.opentest4j.AssertionFailedError
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSendWithConnect0(DatagramUnicastTest.java:430)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSendWithConnect(DatagramUnicastTest.java:383)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSendWithConnect(DatagramUnicastTest.java:212)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest$7.run(DatagramUnicastTest.java:206)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest$7.run(DatagramUnicastTest.java:203)
	at io.netty.testsuite.transport.AbstractComboTestsuiteTest.run(AbstractComboTestsuiteTest.java:52)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSendWithConnect(DatagramUnicastTest.java:203)
	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

Select tests to mute in this pull request:

  • KQueueDatagramUnicastIPv6MappedTest > testSimpleSendWithConnect(TestInfo)

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer
normanmaurer merged commit dc5655e into netty:4.2 Oct 22, 2026
26 of 27 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@netty-project-bot netty-project-bot mentioned this pull request Oct 22, 2026
Auto-port 4.1: Http2: reject generic frames whose payload exceeds SETTINGS_MAX_FRAME_SIZE #18000
Merged
@netty-project-bot

netty-project-bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Auto-port PR for 4.1: #18000

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot removed the needs-cherry-pick-4.1 This PR should be cherry-picked to 4.1 once merged. label Oct 22, 2026
@netty-project-bot netty-project-bot mentioned this pull request Oct 22, 2026
Auto-port 5.0: Http2: reject generic frames whose payload exceeds SETTINGS_MAX_FRAME_SIZE #18001
Merged
@netty-project-bot

netty-project-bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Auto-port PR for 5.0: #18001

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@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 22, 2026
normanmaurer added a commit that referenced this pull request Oct 22, 2026
@normanmaurer
Fix compile errors of the 5.0 auto-port of #17779
d42132f
Motivation:

The auto-port of #17779 does not compile on 5.0 as it was written
against the 4.x API.

Modification:

- Use a short frame type in DefaultHttp2FrameWriter.verifyPayloadLength
  as writeFrame takes a short on 5.0, and mask it with 0xFFFF when
  formatting.
- Adjust the new tests to the 5.0 API: the writers return void, so
  assert on the passed Promise instead of a ChannelFuture, and match
  the CompletionHandler based write.

Result:

codec-http2 compiles again and DefaultHttp2FrameWriterTest passes.
normanmaurer added a commit that referenced this pull request Oct 22, 2026
@netty-project-bot @AbhishekShukla1289
@normanmaurer @bryce-anderson
Auto-port 5.0: Http2: reject generic frames whose payload exceeds SET…
792e0ea
…TINGS_MAX_FRAME_SIZE (#18001)

Auto-port of #17779 to 5.0
Cherry-picked commit: dc5655e

---
Motivation:

RFC 9113 Section 4.2 applies SETTINGS_MAX_FRAME_SIZE to the payload
of every frame. The typed writers in DefaultHttp2FrameWriter honour
the limit advertised by the remote peer: writeData splits large
payloads into multiple DATA frames and writeHeaders uses CONTINUATION.
The generic writeFrame(...) path does not check the limit and writes
the full payload length into a single frame header, so it can emit a
frame that a compliant peer must reject with FRAME_SIZE_ERROR.

Modification:

- Verify the payload length against maxFrameSize in writeFrame before
  allocating the frame header. A generic frame has unknown semantics
  and cannot be split, so the write fails instead: the payload is
  released and the promise is failed with an IllegalArgumentException,
  consistent with the other verify* checks in this class.
- Add tests for a payload of maxFrameSize + 1 (rejected, nothing
  written, payload released) and of exactly maxFrameSize (written).
  The first fails without the change and passes with it.

Result:

Generic frames can no longer exceed the frame size negotiated with
the remote peer. codec-http2 tests: 1633, 0 failures.

Fixes #17426

---------

Co-authored-by: Abhishek Shukla <[email protected]>
Co-authored-by: Netty Project Bot <[email protected]>
Co-authored-by: Norman Maurer <[email protected]>
Co-authored-by: Bryce Anderson <[email protected]>
normanmaurer added a commit that referenced this pull request Oct 22, 2026
@netty-project-bot @AbhishekShukla1289
@normanmaurer @bryce-anderson
Auto-port 4.1: Http2: reject generic frames whose payload exceeds SET…
13ae2b2
…TINGS_MAX_FRAME_SIZE (#18000)

Auto-port of #17779 to 4.1
Cherry-picked commit: dc5655e

---
Motivation:

RFC 9113 Section 4.2 applies SETTINGS_MAX_FRAME_SIZE to the payload
of every frame. The typed writers in DefaultHttp2FrameWriter honour
the limit advertised by the remote peer: writeData splits large
payloads into multiple DATA frames and writeHeaders uses CONTINUATION.
The generic writeFrame(...) path does not check the limit and writes
the full payload length into a single frame header, so it can emit a
frame that a compliant peer must reject with FRAME_SIZE_ERROR.

Modification:

- Verify the payload length against maxFrameSize in writeFrame before
  allocating the frame header. A generic frame has unknown semantics
  and cannot be split, so the write fails instead: the payload is
  released and the promise is failed with an IllegalArgumentException,
  consistent with the other verify* checks in this class.
- Add tests for a payload of maxFrameSize + 1 (rejected, nothing
  written, payload released) and of exactly maxFrameSize (written).
  The first fails without the change and passes with it.

Result:

Generic frames can no longer exceed the frame size negotiated with
the remote peer. codec-http2 tests: 1633, 0 failures.

Fixes #17426

Co-authored-by: Abhishek Shukla <[email protected]>
Co-authored-by: Netty Project Bot <[email protected]>
Co-authored-by: Norman Maurer <[email protected]>
Co-authored-by: Bryce Anderson <[email protected]>
lltopk pushed a commit to lltopk/netty that referenced this pull request Oct 24, 2026
@netty-project-bot @AbhishekShukla1289
@normanmaurer @bryce-anderson @lltopk
Auto-port 4.1: Http2: reject generic frames whose payload exceeds SET…
ca9ff7d
…TINGS_MAX_FRAME_SIZE (netty#18000)

Auto-port of netty#17779 to 4.1
Cherry-picked commit: dc5655e

---
Motivation:

RFC 9113 Section 4.2 applies SETTINGS_MAX_FRAME_SIZE to the payload
of every frame. The typed writers in DefaultHttp2FrameWriter honour
the limit advertised by the remote peer: writeData splits large
payloads into multiple DATA frames and writeHeaders uses CONTINUATION.
The generic writeFrame(...) path does not check the limit and writes
the full payload length into a single frame header, so it can emit a
frame that a compliant peer must reject with FRAME_SIZE_ERROR.

Modification:

- Verify the payload length against maxFrameSize in writeFrame before
  allocating the frame header. A generic frame has unknown semantics
  and cannot be split, so the write fails instead: the payload is
  released and the promise is failed with an IllegalArgumentException,
  consistent with the other verify* checks in this class.
- Add tests for a payload of maxFrameSize + 1 (rejected, nothing
  written, payload released) and of exactly maxFrameSize (written).
  The first fails without the change and passes with it.

Result:

Generic frames can no longer exceed the frame size negotiated with
the remote peer. codec-http2 tests: 1633, 0 failures.

Fixes netty#17426

Co-authored-by: Abhishek Shukla <[email protected]>
Co-authored-by: Netty Project Bot <[email protected]>
Co-authored-by: Norman Maurer <[email protected]>
Co-authored-by: Bryce Anderson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@bryce-anderson bryce-anderson bryce-anderson approved these changes
@normanmaurer normanmaurer normanmaurer approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

4.2.20.Final

Development

Successfully merging this pull request may close these issues.

Generic writeFrame can emit frames over SETTINGS_MAX_FRAME_SIZE

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@AbhishekShukla1289 @normanmaurer @netty-project-bot @bryce-anderson
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.