Repository navigation
http/hpack: fix integer encoding at the prefix maximum - #244
Merged
Merged
Conversation
Signed-off-by: Waqas Hussain <waqas20@gmail.com>
daurnimator
approved these changes
Oct 6, 2026
daurnimator
left a comment
Owner
There was a problem hiding this comment.
Thanks! And great clean PR!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Encoding an integer equal to the HPACK prefix maximum (
2^N - 1) currently omits the required zero continuation byte. The decoder then consumes the next field's byte as part of the integer, potentially corrupting the header blockand causing an HTTP/2 connection error.
For example, encoding 31 with a five-bit prefix and mask 0 produces
1finstead of1f 00. Decoding the current encoding followed byxyields 151 instead of 31.RFC 7541 section 5.1 specifies that the single-byte representation applies only when
I < 2^N - 1: https://www.rfc-editor.org/rfc/rfc7541.html#section-5.1Minimal reproducer: