Skip to content

Auto-port 4.1: Add maxFrameLength support to ProtobufVarint32FrameDecoder#16658

Merged
chrisvest merged 2 commits into
4.1from
auto-port-pr-16633-to-4.1
Apr 17, 2026
Merged

Auto-port 4.1: Add maxFrameLength support to ProtobufVarint32FrameDecoder#16658
chrisvest merged 2 commits into
4.1from
auto-port-pr-16633-to-4.1

Conversation

@netty-project-bot

Copy link
Copy Markdown
Contributor

Auto-port of #16633 to 4.1
Cherry-picked commit: 6ab2d86


Motivation

ProtobufVarint32FrameDecoder has no protection against oversized frames. A malicious client can send a large varint length value and cause the server to allocate excessive memory.

Modification

  • Add maxFrameLength constructor parameter
  • When a frame exceeds maxFrameLength, skip the frame bytes and throw TooLongFrameException
  • Default constructor remains backward-compatible (maxFrameLength = Integer.MAX_VALUE)

Result

Oversized protobuf frames are now rejected with TooLongFrameException instead of causing unbounded memory allocation.

## Motivation

`ProtobufVarint32FrameDecoder` has no protection against oversized
frames. A malicious client can send a large varint length value and
cause the server to allocate excessive memory.

## Modification

- Add `maxFrameLength` constructor parameter
- When a frame exceeds `maxFrameLength`, skip the frame bytes and throw
`TooLongFrameException`
- Default constructor remains backward-compatible (`maxFrameLength =
Integer.MAX_VALUE`)

## Result

Oversized protobuf frames are now rejected with `TooLongFrameException`
instead of causing unbounded memory allocation.

---------

Co-authored-by: Norman Maurer <norman_maurer@apple.com>
(cherry picked from commit 6ab2d86)
@netty-project-bot netty-project-bot deleted the auto-port-pr-16633-to-4.1 branch April 16, 2026 23:49
@normanmaurer normanmaurer restored the auto-port-pr-16633-to-4.1 branch April 16, 2026 23:50
@normanmaurer normanmaurer reopened this Apr 16, 2026
@chrisvest chrisvest added this to the 4.1.133.Final milestone Apr 17, 2026
@chrisvest chrisvest merged commit 56f6d91 into 4.1 Apr 17, 2026
19 checks passed
@chrisvest chrisvest deleted the auto-port-pr-16633-to-4.1 branch April 17, 2026 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants