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 — Auto-port 5.0: ProtobufVarint32FrameDecoder must wait for more data when the length prefix is incomplete by netty-project-bot · Pull Request #17554 · netty/netty

Conversation

@netty-project-bot

@netty-project-bot netty-project-bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Auto-port of #17550 to 5.0
Cherry-picked commit: 335aed7


Motivation:

Since #14050 two incomplete length prefix cases are no longer treated as "need more data" by ProtobufVarint32FrameDecoder:

  • If only 3 bytes are readable and all of them have the continuation bit set, readRawVarint24 returned the partial value and left the readerIndex advanced. decode() then used the low 21 bits of the real length. When these bits are 0, i.e. the message length is an exact multiple of 2 MiB, an empty frame was emitted, the prefix bytes were consumed and the rest of the stream was decoded from the wrong position. A single 2 MiB message split after the third prefix byte was delivered as about 2 million bogus frames without any exception.
  • If exactly 4 bytes are readable and all of them have the continuation bit set, readRawVarint40 threw a CorruptedFrameException although the fifth byte may simply not have been received yet.

Before #14050 both cases reset the readerIndex and returned 0.

Modifications:

  • readRawVarint24 resets the readerIndex and returns 0 when the third byte still has the continuation bit set.
  • readRawVarint40 returns 0 without moving the readerIndex when only 4 bytes are readable, and only throws when the fifth byte is malformed.
  • Add tests that split 1 to 5 byte length prefixes at every position, including lengths that are exact multiples of 2 MiB.

Result:

ProtobufVarint32FrameDecoder produces the same frames
regardless of how the length prefix is fragmented across reads.

Fixes #17549.

Sorry, something went wrong.

Uh oh!

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

All reactions
@ohchanKyu @netty-project-bot
ProtobufVarint32FrameDecoder must wait for more data when the length …
7d3f601
…prefix is incomplete (#17550)

Motivation:

Since #14050 two incomplete length prefix cases are no longer treated as
"need more data" by `ProtobufVarint32FrameDecoder`:

- If only 3 bytes are readable and all of them have the continuation bit
set, `readRawVarint24` returned the partial value and left the
readerIndex advanced. `decode()` then used the low 21 bits of the real
length. When these bits are 0, i.e. the message length is an exact
multiple of 2 MiB, an empty frame was emitted, the prefix bytes were
consumed and the rest of the stream was decoded from the wrong position.
A single 2 MiB message split after the third prefix byte was delivered
as about 2 million bogus frames without any exception.
- If exactly 4 bytes are readable and all of them have the continuation
bit set, `readRawVarint40` threw a `CorruptedFrameException` although
the fifth byte may simply not have been received yet.

Before #14050 both cases reset the readerIndex and returned 0.

Modifications:

- `readRawVarint24` resets the readerIndex and returns 0 when the third
byte still has the continuation bit set.
- `readRawVarint40` returns 0 without moving the readerIndex when only 4
bytes are readable, and only throws when the fifth byte is malformed.
- Add tests that split 1 to 5 byte length prefixes at every position,
including lengths that are exact multiples of 2 MiB.

Result:

`ProtobufVarint32FrameDecoder` produces the same frames
regardless of how the length prefix is fragmented across reads.

Fixes #17549.

(cherry picked from commit 335aed7)
@netty-project-bot netty-project-bot mentioned this pull request Sep 20, 2026
ProtobufVarint32FrameDecoder must wait for more data when the length prefix is incomplete #17550
Merged
@normanmaurer
Fix compile errors
3cf88a7
@normanmaurer normanmaurer added this to the 5.0.0.Final milestone Sep 20, 2026
@testlens-app

testlens-app Bot commented Sep 20, 2026

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: 3cf88a7
▶️ Tests: 231320 executed
⚪️ Checks: 12/12 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 merged commit 0c32a23 into 5.0 Sep 20, 2026
13 checks passed

Uh oh!

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

@normanmaurer
normanmaurer deleted the auto-port-pr-17550-to-5.0 branch September 20, 2026 16:55
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

None yet

Projects

None yet

Milestone

5.0.0.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

@netty-project-bot @normanmaurer @ohchanKyu
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.