Skip to content

Add maxFrameLength support to ProtobufVarint32FrameDecoder#16633

Merged
normanmaurer merged 3 commits into
netty:4.2from
fru1tworld:protobuf-varint32-max-frame-length
Apr 16, 2026
Merged

Add maxFrameLength support to ProtobufVarint32FrameDecoder#16633
normanmaurer merged 3 commits into
netty:4.2from
fru1tworld:protobuf-varint32-max-frame-length

Conversation

@fru1tworld

@fru1tworld fru1tworld commented Apr 12, 2026

Copy link
Copy Markdown
Contributor

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.

@fru1tworld fru1tworld closed this Apr 12, 2026
@fru1tworld fru1tworld reopened this Apr 12, 2026
@fru1tworld fru1tworld marked this pull request as draft April 12, 2026 04:07
@fru1tworld fru1tworld changed the title Add maxFrameLength support to ProtobufVarint32FrameDecoder [WIP] Add maxFrameLength support to ProtobufVarint32FrameDecoder Apr 12, 2026
@fru1tworld fru1tworld force-pushed the protobuf-varint32-max-frame-length branch from 1e753d8 to 6967eb0 Compare April 12, 2026 04:09
@fru1tworld fru1tworld marked this pull request as ready for review April 12, 2026 04:10
@fru1tworld fru1tworld changed the title [WIP] Add maxFrameLength support to ProtobufVarint32FrameDecoder Add maxFrameLength support to ProtobufVarint32FrameDecoder Apr 13, 2026

@normanmaurer normanmaurer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one nit

@normanmaurer

Copy link
Copy Markdown
Member

@fru1tworld did you sign our ICLA already ? https://netty.io/s/icla ?

@normanmaurer normanmaurer requested a review from chrisvest April 15, 2026 15:07
@normanmaurer normanmaurer added this to the 4.2.13.Final milestone Apr 15, 2026
@chrisvest chrisvest 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 Apr 15, 2026
@fru1tworld

Copy link
Copy Markdown
Contributor Author

Yes, I've just signed the ICLA. Thank you!

@normanmaurer normanmaurer merged commit 6ab2d86 into netty:4.2 Apr 16, 2026
23 checks passed
@netty-project-bot

Copy link
Copy Markdown
Contributor

Auto-port PR for 4.1: #16658

netty-project-bot pushed a commit that referenced this pull request Apr 16, 2026
## 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)
@github-actions github-actions Bot removed the needs-cherry-pick-4.1 This PR should be cherry-picked to 4.1 once merged. label Apr 16, 2026
netty-project-bot pushed a commit that referenced this pull request Apr 16, 2026
## 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

Copy link
Copy Markdown
Contributor

Auto-port PR for 5.0: #16659

@github-actions github-actions Bot removed the needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. label Apr 16, 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 Apr 16, 2026
@netty-project-bot

Copy link
Copy Markdown
Contributor

Could not create auto-port PR.
I could cherry-pick onto 4.1 just fine, but pushing the new branch failed.

@netty-project-bot

Copy link
Copy Markdown
Contributor

Could not create auto-port PR.
I could cherry-pick onto 5.0 just fine, but pushing the new branch failed.

chrisvest pushed a commit that referenced this pull request Apr 17, 2026
…oder (#16658)

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.

---------

Co-authored-by: fru1tworld <127650598+fru1tworld@users.noreply.github.com>
Co-authored-by: Norman Maurer <norman_maurer@apple.com>
@chrisvest chrisvest removed 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 Apr 17, 2026
chrisvest pushed a commit that referenced this pull request Apr 18, 2026
…oder (#16659)

Auto-port of #16633 to 5.0
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.

---------

Co-authored-by: fru1tworld <127650598+fru1tworld@users.noreply.github.com>
Co-authored-by: Norman Maurer <norman_maurer@apple.com>
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