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 — Port 5.0: Don't lose frames when a delimiter is split across reads (#17911) by normanmaurer · Pull Request #17917 · netty/netty

Conversation

@normanmaurer

@normanmaurer normanmaurer commented Oct 19, 2026

Copy link
Copy Markdown
Member

Auto-port of #17665 to 5.0
Cherry-picked commit: 07aed99


Motivation:

When DelimiterBasedFrameDecoder finds no delimiter in the buffer, it
counts all readable bytes as frame content and, while discarding a too
long frame, skips all of them. That includes a trailing partial
delimiter whose remaining bytes are in the next read. With a multi-byte
delimiter, this loses frames. In both examples below the delimiter is
## and maxFrameLength is 4:

  • While a too long frame is discarded, the first bytes of the delimiter
    that ends it are thrown away. The delimiter is never seen, so discarding
    continues through the next valid frame, which is lost silently. For
    example, AAAAAAAAAA# then #ok##next## gives TooLongFrameException, next: the ok frame is lost. With failFast = false, the two frames
    are also reported as a single exception.
  • A frame of up to maxFrameLength bytes is rejected when a read ends
    inside its delimiter, because the partial delimiter is counted. For
    example, ABCD# then #ok## gives only TooLongFrameException: ABCD
    is lost, and ok too (by the first case).

Single-byte delimiters, and line delimiters (which are handled by
LineBasedFrameDecoder), are not affected.

Modification:

  • When no delimiter is found, compute the longest suffix of the buffer
    that is the beginning of a delimiter, and don't count or skip it. This
    check only runs when no delimiter was found. It compares at most
    delimiter length - 1 bytes per delimiter, next to the existing search
    of the whole buffer.
  • New tests in DelimiterBasedFrameDecoderTest:
  • a frame of maxFrameLength bytes with its delimiter split across
    reads;
  • a delimiter split across reads while discarding, with and without
    failFast;
    • maxFrameLength is still enforced when the delimiter is split.

Result:

Frames are not lost when a multi-byte delimiter is split across reads.
The limit is still exact: the branch that finds the delimiter checks it
as before.


Co-authored-by: allthingssecurity [email protected]
Co-authored-by: Norman Maurer [email protected]

Sorry, something went wrong.

Uh oh!

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

All reactions
@netty-project-bot @allthingssecurity @normanmaurer
Port 5.0: Don't lose frames when a delimiter is split across reads (#…
2737bae
…17911)

Auto-port of #17665 to 5.0
Cherry-picked commit: 07aed99

---
Motivation:

When `DelimiterBasedFrameDecoder` finds no delimiter in the buffer, it
counts all readable bytes as frame content and, while discarding a too
long frame, skips all of them. That includes a trailing partial
delimiter whose remaining bytes are in the next read. With a multi-byte
delimiter, this loses frames. In both examples below the delimiter is
`##` and `maxFrameLength` is 4:

- While a too long frame is discarded, the first bytes of the delimiter
that ends it are thrown away. The delimiter is never seen, so discarding
continues through the next valid frame, which is lost silently. For
example, `AAAAAAAAAA#` then `#ok##next##` gives `TooLongFrameException,
next`: the `ok` frame is lost. With `failFast = false`, the two frames
are also reported as a single exception.
- A frame of up to `maxFrameLength` bytes is rejected when a read ends
inside its delimiter, because the partial delimiter is counted. For
example, `ABCD#` then `#ok##` gives only `TooLongFrameException`: `ABCD`
is lost, and `ok` too (by the first case).

Single-byte delimiters, and line delimiters (which are handled by
`LineBasedFrameDecoder`), are not affected.

Modification:

- When no delimiter is found, compute the longest suffix of the buffer
that is the beginning of a delimiter, and don't count or skip it. This
check only runs when no delimiter was found. It compares at most
`delimiter length - 1` bytes per delimiter, next to the existing search
of the whole buffer.
- New tests in `DelimiterBasedFrameDecoderTest`:
- a frame of `maxFrameLength` bytes with its delimiter split across
reads;
- a delimiter split across reads while discarding, with and without
`failFast`;
  - `maxFrameLength` is still enforced when the delimiter is split.

Result:

Frames are not lost when a multi-byte delimiter is split across reads.
The limit is still exact: the branch that finds the delimiter checks it
as before.

---------

Co-authored-by: allthingssecurity <[email protected]>
Co-authored-by: Norman Maurer <[email protected]>
@normanmaurer normanmaurer added this to the 5.0.0.Final milestone Oct 19, 2026
@normanmaurer
Port 5.0: Read SOCKS5 length octets unsigned in the legacy socks deco…
aeec6a6
…ders (#17912)

Motivation:

SocksCmdRequestDecoder and SocksCmdResponseDecoder read the DOMAIN
address length octet (RFC 1928), and SocksAuthRequestDecoder reads ULEN
and PLEN (RFC 1929), as signed bytes. Wire values 0x80..0xFF sign-extend
to -128..-1, so spec-legal domain names, user names and passwords of 128
to 255 bytes cannot be decoded. This also means frames produced by
SocksCmdRequest, SocksCmdResponse and SocksAuthRequest, which accept up
to 255 characters, are rejected by their own decoders.

Modification:

Read the four length octets as unsigned values. Add regression tests
with 128 and 255 byte domain names, user names and passwords for each
decoder.

Result:

The legacy SOCKS5 decoders accept every length value the protocol
allows.
@normanmaurer
normanmaurer force-pushed the port-17912-socks-unsigned-5.0 branch from 148315f to aeec6a6 Compare October 19, 2026 14:21
@testlens-app

testlens-app Bot commented Oct 19, 2026

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: aeec6a6
▶️ Tests: 39023 executed
⚪️ Checks: 13/13 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 a65bcf8 into 5.0 Oct 19, 2026
14 checks passed

Uh oh!

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

@normanmaurer
normanmaurer deleted the port-17912-socks-unsigned-5.0 branch October 19, 2026 17:06
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.

2 participants

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