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 — Reject truncated QPACK prefixed integers in field section decode by Raghuvardhan-Reddy78 · Pull Request #17778 · netty/netty

Conversation

@Raghuvardhan-Reddy78

@Raghuvardhan-Reddy78 Raghuvardhan-Reddy78 commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Motivation:

QpackDecoder.decode works on a buffer that already holds the complete QPACK field section. Each line is decoded with QpackUtil.decodePrefixedInteger, which returns -1 when it would need more bytes and rewinds the reader index. In the decode path that -1 was only guarded by assert idx >= 0, which is off in production.

When the dynamic table is enabled a peer can send a tiny HEADERS block whose last line is an Indexed Field Line With Post-Base Index with a truncated integer (e.g. the 3 bytes 02 00 1f). decode then calls getEntryRelativeEncodedField(base - 1), gets a live entry, never consumes the trailing byte, and the while (in.isReadable()) loop spins forever on the QUIC event loop thread. With assertions enabled it throws AssertionError instead, but the production path is a hard hang. The same -1 reaches the dynamic-table index math and the literal length in the other helpers.

Modification:

Added decodePrefixedIntOrThrow / decodePrefixedLongOrThrow in QpackDecoder that turn a -1 result into a QpackException (decompression error), and routed every prefixed-integer read in decodeIndexed, decodeIndexedWithPostBase, decodeLiteralWithNameRef, decodeLiteralWithPostBaseNameRef, decodeHuffmanEncodedLiteral, decodeRequiredInsertCount and decodeBase through them. The streaming encoder/decoder instruction handlers still use the raw -1 "need more bytes" contract and are untouched.

Result:

A truncated field section now fails with a QPACK decompression error that Http3FrameCodec already handles, instead of hanging the event loop. Added a regression test in QpackDecoderTest that reproduces the post-base case; it hangs/asserts before the change and passes after.

Sorry, something went wrong.

Uh oh!

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

All reactions
Raghuvardhan-Reddy78 and others added 2 commits October 9, 2026 02:25
@Raghuvardhan-Reddy78
Reject truncated QPACK prefixed integers in field section decode
356f8ff
@normanmaurer
Merge branch '4.2' into qpack-truncated-integer
4d5293e
@normanmaurer normanmaurer added this to the 4.2.20.Final milestone Oct 14, 2026
@normanmaurer normanmaurer added the needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. label Oct 14, 2026
@normanmaurer

normanmaurer commented Oct 14, 2026

Copy link
Copy Markdown
Member

@Raghuvardhan-Reddy78 did you sign our icla yet ? https://netty.io/s/icla ?

All reactions

Sorry, something went wrong.

Uh oh!

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

@testlens-app

testlens-app Bot commented Oct 14, 2026

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: 4d5293e
▶️ Tests: 45526 executed
⚪️ Checks: 28/28 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.

@Raghuvardhan-Reddy78

Raghuvardhan-Reddy78 commented Oct 18, 2026

Copy link
Copy Markdown
Contributor Author

@normanmaurer yes, I signed the ICLA already (same as for #17812).

All reactions

Sorry, something went wrong.

Uh oh!

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

@normanmaurer
normanmaurer merged commit e526345 into netty:4.2 Oct 19, 2026
29 checks passed

Uh oh!

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

@netty-project-bot

netty-project-bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Auto-port PR for 5.0: #17922

All reactions

Sorry, something went wrong.

Uh oh!

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

@github-actions github-actions Bot removed the needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. label Oct 19, 2026
@netty-project-bot netty-project-bot mentioned this pull request Oct 19, 2026
Auto-port 5.0: Reject truncated QPACK prefixed integers in field section decode #17922
Merged
normanmaurer added a commit that referenced this pull request Oct 19, 2026
@netty-project-bot @Raghuvardhan-Reddy78 @normanmaurer
Auto-port 5.0: Reject truncated QPACK prefixed integers in field sect…
bda5c06
…ion decode (#17922)

Auto-port of #17778 to 5.0
Cherry-picked commit: e526345

---
Motivation:

QpackDecoder.decode works on a buffer that already holds the complete
QPACK field section. Each line is decoded with
QpackUtil.decodePrefixedInteger, which returns -1 when it would need
more bytes and rewinds the reader index. In the decode path that -1 was
only guarded by `assert idx >= 0`, which is off in production.

When the dynamic table is enabled a peer can send a tiny HEADERS block
whose last line is an Indexed Field Line With Post-Base Index with a
truncated integer (e.g. the 3 bytes `02 00 1f`). decode then calls
getEntryRelativeEncodedField(base - 1), gets a live entry, never
consumes the trailing byte, and the `while (in.isReadable())` loop spins
forever on the QUIC event loop thread. With assertions enabled it throws
AssertionError instead, but the production path is a hard hang. The same
-1 reaches the dynamic-table index math and the literal length in the
other helpers.

Modification:

Added decodePrefixedIntOrThrow / decodePrefixedLongOrThrow in
QpackDecoder that turn a -1 result into a QpackException (decompression
error), and routed every prefixed-integer read in decodeIndexed,
decodeIndexedWithPostBase, decodeLiteralWithNameRef,
decodeLiteralWithPostBaseNameRef, decodeHuffmanEncodedLiteral,
decodeRequiredInsertCount and decodeBase through them. The streaming
encoder/decoder instruction handlers still use the raw -1 "need more
bytes" contract and are untouched.

Result:

A truncated field section now fails with a QPACK decompression error
that Http3FrameCodec already handles, instead of hanging the event loop.
Added a regression test in QpackDecoderTest that reproduces the
post-base case; it hangs/asserts before the change and passes after.

Co-authored-by: Raghuvardhan-Reddy78 <[email protected]>
Co-authored-by: Norman Maurer <[email protected]>
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

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

@Raghuvardhan-Reddy78 @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.