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 — Fix NPE when upgrade message fails to aggregate by yawkat · Pull Request #14816 · netty/netty

Conversation

@yawkat

@yawkat yawkat commented Feb 13, 2025

Copy link
Copy Markdown
Contributor

Motivation:

When an HTTP message fails to aggregate, for example due to an invalid 'Expect' header, MessageAggregator does not produce a FullHttpRequest. HttpServerUpgradeHandler would then continue with the next request, wrongly believing it to be an upgrade request, even though only the previous one was. This produces an NPE:

Caused by: java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.length()" because "header" is null
	at io.netty.handler.codec.http.HttpServerUpgradeHandler.splitHeader(HttpServerUpgradeHandler.java:429)
	at io.netty.handler.codec.http.HttpServerUpgradeHandler.upgrade(HttpServerUpgradeHandler.java:328)
	at io.netty.handler.codec.http.HttpServerUpgradeHandler.decode(HttpServerUpgradeHandler.java:290)
	at io.netty.handler.codec.http.HttpServerUpgradeHandler.decode(HttpServerUpgradeHandler.java:40)
	at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:91)
	... 35 common frames omitted

Modification:

When the upgrade handler sees a LastHttpContent, cancel the current upgrade and cancel aggregation.

Result:

No NPE for this input.

Found by fuzzing.

Sorry, something went wrong.

Uh oh!

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

He-Pin reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
yawkat added 7 commits February 13, 2025 14:03
@yawkat
Fix NPE when upgrade message fails to aggregate
87770ad
Motivation:

When an HTTP message fails to aggregate, for example due to an invalid 'Expect' header, MessageAggregator does not produce a FullHttpRequest. HttpServerUpgradeHandler would then continue with the next request, wrongly believing it to be an upgrade request, even though only the previous one was. This produces an NPE:

```
Caused by: java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.length()" because "header" is null
	at io.netty.handler.codec.http.HttpServerUpgradeHandler.splitHeader(HttpServerUpgradeHandler.java:429)
	at io.netty.handler.codec.http.HttpServerUpgradeHandler.upgrade(HttpServerUpgradeHandler.java:328)
	at io.netty.handler.codec.http.HttpServerUpgradeHandler.decode(HttpServerUpgradeHandler.java:290)
	at io.netty.handler.codec.http.HttpServerUpgradeHandler.decode(HttpServerUpgradeHandler.java:40)
	at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:91)
	... 35 common frames omitted
```

Modification:

When the upgrade handler sees a LastHttpContent, cancel the current upgrade and cancel aggregation.

Result:

No NPE for this input.

Found by fuzzing.
@yawkat
add japicmp exception
c6ab34f
@yawkat
add revapi exception
15f7bf2
@yawkat
add revapi exception
9333090
@yawkat
add revapi exception
2c541ac
@yawkat
add revapi exception
40431c5
@yawkat
add revapi exception
4aeead6
chrisvest
chrisvest reviewed Feb 13, 2025
View reviewed changes
Comment thread codec/src/main/java/io/netty/handler/codec/MessageAggregator.java
}

private void releaseCurrentMessage() {
protected final void releaseCurrentMessage() {

@chrisvest chrisvest Feb 13, 2025

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.

Maybe the compatibility checkers would like it more if this wasn't final.

Sorry, something went wrong.

Uh oh!

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

All reactions
@yawkat

yawkat commented Feb 13, 2025 via email

Copy link
Copy Markdown
Contributor Author
Yes, but it seemed like a weird method to allow extension of. But maybe worth it to avoid the binary incompatibility, even if minor. Though I think it might still be source incompatible?
…
On Thu, Feb 13, 2025, 23:22 Chris Vest ***@***.***> wrote: ***@***.**** commented on this pull request. ------------------------------ In codec/src/main/java/io/netty/handler/codec/MessageAggregator.java <#14816 (comment)>: > @@ -460,12 +460,12 @@ public void handlerRemoved(ChannelHandlerContext ctx) throws Exception { } } - private void releaseCurrentMessage() { + protected final void releaseCurrentMessage() { Maybe the compatibility checkers would like it more if this wasn't final. — Reply to this email directly, view it on GitHub <#14816 (review)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AASIZIKBIEATM277PVRRHSD2PULL5AVCNFSM6AAAAABXCEHJGSVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDMMJWGM2TCMBWGI> . You are receiving this because you authored the thread.Message ID: ***@***.***>
All reactions

Sorry, something went wrong.

Uh oh!

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

normanmaurer
normanmaurer approved these changes Feb 15, 2025
View reviewed changes
@chrisvest
chrisvest merged commit 84120a7 into netty:4.1 Feb 18, 2025
@chrisvest chrisvest added this to the 4.1.119.Final milestone Feb 18, 2025
chrisvest pushed a commit to chrisvest/netty that referenced this pull request Feb 18, 2025
@yawkat @chrisvest
Fix NPE when upgrade message fails to aggregate (netty#14816)
74709ab
Motivation:

When an HTTP message fails to aggregate, for example due to an invalid
'Expect' header, MessageAggregator does not produce a FullHttpRequest.
HttpServerUpgradeHandler would then continue with the next request,
wrongly believing it to be an upgrade request, even though only the
previous one was. This produces an NPE:

```
Caused by: java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.length()" because "header" is null
	at io.netty.handler.codec.http.HttpServerUpgradeHandler.splitHeader(HttpServerUpgradeHandler.java:429)
	at io.netty.handler.codec.http.HttpServerUpgradeHandler.upgrade(HttpServerUpgradeHandler.java:328)
	at io.netty.handler.codec.http.HttpServerUpgradeHandler.decode(HttpServerUpgradeHandler.java:290)
	at io.netty.handler.codec.http.HttpServerUpgradeHandler.decode(HttpServerUpgradeHandler.java:40)
	at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:91)
	... 35 common frames omitted
```

Modification:

When the upgrade handler sees a LastHttpContent, cancel the current
upgrade and cancel aggregation.

Result:

No NPE for this input.

Found by fuzzing.
chrisvest pushed a commit to chrisvest/netty that referenced this pull request Feb 18, 2025
@yawkat @chrisvest
Fix NPE when upgrade message fails to aggregate (netty#14816)
b977322
Motivation:

When an HTTP message fails to aggregate, for example due to an invalid
'Expect' header, MessageAggregator does not produce a FullHttpRequest.
HttpServerUpgradeHandler would then continue with the next request,
wrongly believing it to be an upgrade request, even though only the
previous one was. This produces an NPE:

```
Caused by: java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.length()" because "header" is null
    at io.netty.handler.codec.http.HttpServerUpgradeHandler.splitHeader(HttpServerUpgradeHandler.java:429)
    at io.netty.handler.codec.http.HttpServerUpgradeHandler.upgrade(HttpServerUpgradeHandler.java:328)
    at io.netty.handler.codec.http.HttpServerUpgradeHandler.decode(HttpServerUpgradeHandler.java:290)
    at io.netty.handler.codec.http.HttpServerUpgradeHandler.decode(HttpServerUpgradeHandler.java:40)
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:91)
    ... 35 common frames omitted
```

Modification:

When the upgrade handler sees a LastHttpContent, cancel the current
upgrade and cancel aggregation.

Result:

No NPE for this input.

Found by fuzzing.
normanmaurer pushed a commit that referenced this pull request Feb 18, 2025
@chrisvest @yawkat
Fix NPE when upgrade message fails to aggregate (#14816) (#14831)
3f29394
Motivation:

When an HTTP message fails to aggregate, for example due to an invalid
'Expect' header, MessageAggregator does not produce a FullHttpRequest.
HttpServerUpgradeHandler would then continue with the next request,
wrongly believing it to be an upgrade request, even though only the
previous one was. This produces an NPE:

```
Caused by: java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.length()" because "header" is null
	at io.netty.handler.codec.http.HttpServerUpgradeHandler.splitHeader(HttpServerUpgradeHandler.java:429)
	at io.netty.handler.codec.http.HttpServerUpgradeHandler.upgrade(HttpServerUpgradeHandler.java:328)
	at io.netty.handler.codec.http.HttpServerUpgradeHandler.decode(HttpServerUpgradeHandler.java:290)
	at io.netty.handler.codec.http.HttpServerUpgradeHandler.decode(HttpServerUpgradeHandler.java:40)
	at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:91)
	... 35 common frames omitted
```

Modification:

When the upgrade handler sees a LastHttpContent, cancel the current
upgrade and cancel aggregation.

Result:

No NPE for this input.

Found by fuzzing.

Co-authored-by: Jonas Konrad <[email protected]>
normanmaurer pushed a commit that referenced this pull request Feb 18, 2025
@chrisvest @yawkat
Fix NPE when upgrade message fails to aggregate (#14816) (#14832)
52b8cc5
Motivation:

When an HTTP message fails to aggregate, for example due to an invalid
'Expect' header, MessageAggregator does not produce a FullHttpRequest.
HttpServerUpgradeHandler would then continue with the next request,
wrongly believing it to be an upgrade request, even though only the
previous one was. This produces an NPE:

```
Caused by: java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.length()" because "header" is null
    at io.netty.handler.codec.http.HttpServerUpgradeHandler.splitHeader(HttpServerUpgradeHandler.java:429)
    at io.netty.handler.codec.http.HttpServerUpgradeHandler.upgrade(HttpServerUpgradeHandler.java:328)
    at io.netty.handler.codec.http.HttpServerUpgradeHandler.decode(HttpServerUpgradeHandler.java:290)
    at io.netty.handler.codec.http.HttpServerUpgradeHandler.decode(HttpServerUpgradeHandler.java:40)
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:91)
    ... 35 common frames omitted
```

Modification:

When the upgrade handler sees a LastHttpContent, cancel the current
upgrade and cancel aggregation.

Result:

No NPE for this input.

Found by fuzzing.

---------

Co-authored-by: Jonas Konrad <[email protected]>
@dongjoon-hyun dongjoon-hyun mentioned this pull request Mar 4, 2025
[SPARK-51387][BUILD] Upgrade Netty to 4.1.119.Final apache/spark#50150
Closed
dongjoon-hyun added a commit to apache/spark that referenced this pull request Mar 4, 2025
@dongjoon-hyun
[SPARK-51387][BUILD] Upgrade Netty to 4.1.119.Final
3d949af
### What changes were proposed in this pull request?

This PR aims to Upgrade Netty to 4.1.119.Final.

### Why are the changes needed?

- https://github.com/netty/netty/milestone/309?closed=1
  - netty/netty#14855
  - netty/netty#14830
  - netty/netty#14816
  - netty/netty#14810

### Does this PR introduce _any_ user-facing change?

No behavior change.

### How was this patch tested?

Pass the CIs.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes #50150 from dongjoon-hyun/SPARK-51387.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
dongjoon-hyun added a commit to apache/spark that referenced this pull request Mar 4, 2025
@dongjoon-hyun
[SPARK-51387][BUILD] Upgrade Netty to 4.1.119.Final
0403c8e
### What changes were proposed in this pull request?

This PR aims to Upgrade Netty to 4.1.119.Final.

### Why are the changes needed?

- https://github.com/netty/netty/milestone/309?closed=1
  - netty/netty#14855
  - netty/netty#14830
  - netty/netty#14816
  - netty/netty#14810

### Does this PR introduce _any_ user-facing change?

No behavior change.

### How was this patch tested?

Pass the CIs.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes #50150 from dongjoon-hyun/SPARK-51387.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
(cherry picked from commit 3d949af)
Signed-off-by: Dongjoon Hyun <[email protected]>
dongjoon-hyun added a commit to dongjoon-hyun/spark that referenced this pull request Mar 5, 2025
@dongjoon-hyun
[SPARK-51387][BUILD] Upgrade Netty to 4.1.119.Final
01cef5e
### What changes were proposed in this pull request?

This PR aims to Upgrade Netty to 4.1.119.Final.

### Why are the changes needed?

- https://github.com/netty/netty/milestone/309?closed=1
  - netty/netty#14855
  - netty/netty#14830
  - netty/netty#14816
  - netty/netty#14810

### Does this PR introduce _any_ user-facing change?

No behavior change.

### How was this patch tested?

Pass the CIs.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes apache#50150 from dongjoon-hyun/SPARK-51387.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
(cherry picked from commit 3d949af)
Signed-off-by: Dongjoon Hyun <[email protected]>
@dongjoon-hyun dongjoon-hyun mentioned this pull request Mar 5, 2025
[SPARK-51387][BUILD][4.0] Upgrade Netty to 4.1.119.Final apache/spark#50174
Closed
@yawkat yawkat added the found by fuzzing label Sep 9, 2025
zifeif2 pushed a commit to zifeif2/spark that referenced this pull request Nov 14, 2025
@dongjoon-hyun
[SPARK-51387][BUILD] Upgrade Netty to 4.1.119.Final
338772a
### What changes were proposed in this pull request?

This PR aims to Upgrade Netty to 4.1.119.Final.

### Why are the changes needed?

- https://github.com/netty/netty/milestone/309?closed=1
  - netty/netty#14855
  - netty/netty#14830
  - netty/netty#14816
  - netty/netty#14810

### Does this PR introduce _any_ user-facing change?

No behavior change.

### How was this patch tested?

Pass the CIs.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes apache#50150 from dongjoon-hyun/SPARK-51387.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
(cherry picked from commit e84c345)
Signed-off-by: Dongjoon Hyun <[email protected]>
prabhjyotsingh pushed a commit to acceldata-io/spark3 that referenced this pull request Sep 10, 2026
@dongjoon-hyun @prabhjyotsingh
[SPARK-51387][BUILD] Upgrade Netty to 4.1.119.Final
7779d8b
This PR aims to Upgrade Netty to 4.1.119.Final.

- https://github.com/netty/netty/milestone/309?closed=1
  - netty/netty#14855
  - netty/netty#14830
  - netty/netty#14816
  - netty/netty#14810

No behavior change.

Pass the CIs.

No.

Closes apache#50150 from dongjoon-hyun/SPARK-51387.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
prabhjyotsingh pushed a commit to acceldata-io/spark3 that referenced this pull request Sep 11, 2026
@dongjoon-hyun @prabhjyotsingh
[SPARK-51387][BUILD] Upgrade Netty to 4.1.119.Final
fb76b60
This PR aims to Upgrade Netty to 4.1.119.Final.

- https://github.com/netty/netty/milestone/309?closed=1
  - netty/netty#14855
  - netty/netty#14830
  - netty/netty#14816
  - netty/netty#14810

No behavior change.

Pass the CIs.

No.

Closes apache#50150 from dongjoon-hyun/SPARK-51387.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
prabhjyotsingh pushed a commit to acceldata-io/spark3 that referenced this pull request Sep 11, 2026
@dongjoon-hyun @prabhjyotsingh
[SPARK-51387][BUILD] Upgrade Netty to 4.1.119.Final
830b8a6
This PR aims to Upgrade Netty to 4.1.119.Final.

- https://github.com/netty/netty/milestone/309?closed=1
  - netty/netty#14855
  - netty/netty#14830
  - netty/netty#14816
  - netty/netty#14810

No behavior change.

Pass the CIs.

No.

Closes apache#50150 from dongjoon-hyun/SPARK-51387.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
Ko-dany pushed a commit to acceldata-io/spark3 that referenced this pull request Sep 11, 2026
@dongjoon-hyun @Ko-dany
[SPARK-51387][BUILD] Upgrade Netty to 4.1.119.Final
fa21932
This PR aims to Upgrade Netty to 4.1.119.Final.

- https://github.com/netty/netty/milestone/309?closed=1
  - netty/netty#14855
  - netty/netty#14830
  - netty/netty#14816
  - netty/netty#14810

No behavior change.

Pass the CIs.

No.

Closes apache#50150 from dongjoon-hyun/SPARK-51387.

Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
@normanmaurer normanmaurer mentioned this pull request Sep 14, 2026
Http2: Reserve promised stream for PUSH_PROMISE after local RST_STREAM #17471
Closed
@normanmaurer normanmaurer mentioned this pull request Sep 21, 2026
cache failure 1233e4a5 #17565
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@chrisvest chrisvest chrisvest left review comments
@normanmaurer normanmaurer normanmaurer approved these changes

Uh oh!

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

Assignees

No one assigned

Labels

found by fuzzing

Projects

None yet

Milestone

4.1.119.Final

Development

Successfully merging this pull request may close these issues.

Uh oh!

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

3 participants

@yawkat @chrisvest @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.