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 — Decline a valueless server_max_window_bits offer by arimu1 · Pull Request #18507 · netty/netty

Conversation

@arimu1

@arimu1 arimu1 commented Nov 22, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

Motivation:

A client can offer permessage-deflate with server_max_window_bits and no value. That parameter is stored as null. RFC 7692 section 7.1.2.1 requires server_max_window_bits in an offer to carry a value, so the server must decline the offer. When a custom server window is allowed, PerMessageDeflateServerExtensionHandshaker passed the null to Integer.parseInt, which threw NumberFormatException and aborted the handshake.

RFC 7692 section 7.1 also requires the server to decline an offer that contains a parameter with an invalid value. Section 7.1.2 defines the value of server_max_window_bits and client_max_window_bits as 1*DIGIT without leading zeroes. The handshaker parsed those values with Integer.parseInt, so a malformed value such as "abc" threw NumberFormatException instead of declining the offer, while values such as "+12" or "012" were accepted.

A missing client_max_window_bits value is still allowed. That path is unchanged and keeps the preferred client window.

Modification:

Decline the extension when server_max_window_bits has no value. Parse server_max_window_bits (when a custom server window is allowed) and a valued client_max_window_bits with a helper that accepts only one or two ASCII digits and no leading zero. Anything else is mapped to -1, which is outside the allowed window range, so the offer is declined and handshakeExtension does not throw NumberFormatException. An in-range server_max_window_bits offer is still capped at the configured server window.

PerMessageDeflateServerExtensionHandshakerTest covers a null server_max_window_bits offer with server window size 12 allowed: the handshake is declined. It also declines invalid values of both parameters (non-digits, signs, leading zeroes, and out-of-range sizes) and accepts every valid size from 8 to 15. A valid server offer is still advertised capped at 12.

Offers that were accepted before, for example a signed value or one with leading zeroes, are now declined.

Result:

Fixes #13896.

Sorry, something went wrong.

Uh oh!

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

All reactions
@arimu1
Keep a valueless server_max_window_bits offer
6546928
Motivation:

A permessage-deflate offer can include server_max_window_bits with no
value. That is stored as a null parameter. When the server allows a
custom server window, handshakeExtension passed the null to
Integer.parseInt and threw NumberFormatException.

client_max_window_bits already skips a missing value. A missing
server_max_window_bits value should do the same and leave the
configured server window in place. A non-numeric value still throws.

Modification:

Skip Integer.parseInt when server_max_window_bits has no value. Add a
regression test that handshakes with a null value and checks the
configured window is unchanged.

Result:

Fixes netty#13896
@normanmaurer

normanmaurer commented Nov 23, 2026

Copy link
Copy Markdown
Member

@amirhadadi I don't think is the correct in terms of the RFC. It should decline it

All reactions

Sorry, something went wrong.

Uh oh!

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

@arimu1
Decline a valueless server_max_window_bits offer
8862bd6
Motivation:

RFC 7692 requires server_max_window_bits in a permessage-deflate offer
to carry a value. A missing value is stored as null. Keeping the
configured window accepted an offer the server must decline, and the
previous parseInt(null) path threw NumberFormatException.

Modification:

Decline the extension when server_max_window_bits has no value. A
valued offer is unchanged: out of range is declined, and an in-range
offer is capped at the configured server window. Update the regression
test to expect a declined handshake.

Result:

Fixes netty#13896. A valueless server_max_window_bits offer no longer throws
and is not negotiated.
@arimu1 arimu1 changed the title Keep a valueless server_max_window_bits offer Decline a valueless server_max_window_bits offer Nov 23, 2026
@normanmaurer
Decline non-conforming max window bits offers in permessage-deflate
360e4d3
Motivation:

RFC 7692 section 7.1 requires a server to decline an offer that contains
a parameter with an invalid value. The value of server_max_window_bits
and client_max_window_bits is defined as 1*DIGIT without leading zeroes
(section 7.1.2). PerMessageDeflateServerExtensionHandshaker parsed it
with Integer.parseInt, so a malformed value such as "abc" threw
NumberFormatException out of handshakeExtension instead of declining the
offer, while values such as "+12" or "012" were accepted.

Modification:

Parse the window bits with a strict helper that only accepts ASCII
digits without a leading zero, and map everything else to a value outside
of the allowed range so the offer is declined. Add tests for invalid
values of both parameters and for every valid value.

Result:

A malformed server_max_window_bits or client_max_window_bits offer no
longer throws and is declined as the RFC requires.

This is a potentially breaking change: offers that were accepted before
(for example a signed value or one with leading zeroes) are now declined.
@normanmaurer normanmaurer added this to the 4.2.22.Final milestone Nov 23, 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 Nov 23, 2026
@testlens-app

testlens-app Bot commented Nov 23, 2026

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: 360e4d3
▶️ Tests: 98882 executed
⚪️ Checks: 30/30 completed


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 commented Nov 24, 2026

Copy link
Copy Markdown
Member

@arimu1 can you update the PR description to actually match the code behavior ?

All reactions

Sorry, something went wrong.

Uh oh!

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

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

Reviewers

No reviews

Uh oh!

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

Assignees

No one assigned

Labels

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.

Projects

None yet

Milestone

4.2.22.Final

Development

Successfully merging this pull request may close these issues.

The PerMessageDeflateServerExtensionHandshaker class triggered a NumberFormatException

Uh oh!

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

2 participants

@arimu1 @normanmaurer
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.