Skip to content

Comments

HTTP/2: ignore reserved MSB in 31-bit fields#633

Merged
arturobernalg merged 1 commit intoapache:masterfrom
arturobernalg:h2-rfc9113-reserved-bit
Feb 22, 2026
Merged

HTTP/2: ignore reserved MSB in 31-bit fields#633
arturobernalg merged 1 commit intoapache:masterfrom
arturobernalg:h2-rfc9113-reserved-bit

Conversation

@arturobernalg
Copy link
Member

Mask the reserved MSB on all received 31-bit identifiers / values (frame Stream Identifier, WINDOW_UPDATE increment, PUSH_PROMISE promised stream id, GOAWAY last-stream-id) to comply with RFC 9113 and avoid mis-parsing them as signed integers.

RFC 9113 4.1
(Frame Format): "The semantics of this bit are undefined, and the bit MUST remain unset (0x00) when sending and MUST be ignored when receiving."

RFC 9113 4.1
(Frame Format): "A stream identifier ... expressed as an unsigned 31-bit integer."

RFC 9113 6.6
(PUSH_PROMISE): "An unsigned 31-bit integer that identifies the stream that is reserved by the PUSH_PROMISE."

RFC 9113 6.8
(GOAWAY), Figure 10: "Reserved (1), Last-Stream-ID (31)"

RFC 9113 6.9
(WINDOW_UPDATE): "The frame payload of a WINDOW_UPDATE frame is one reserved bit plus an unsigned 31-bit integer."

RFC 9113 6.9
(WINDOW_UPDATE): "The legal range for the increment to the flow-control window is 1 to 2^{31}-1."

@arturobernalg arturobernalg requested a review from ok2c February 21, 2026 18:22
Mask the reserved MSB when parsing the HTTP/2 stream identifier and 31-bit
values carried by WINDOW_UPDATE, PUSH_PROMISE and GOAWAY. This avoids
treating otherwise valid values as negative ints and matches RFC 9113.
@arturobernalg arturobernalg force-pushed the h2-rfc9113-reserved-bit branch from 508db47 to 134f6bf Compare February 22, 2026 11:16
@arturobernalg arturobernalg requested a review from ok2c February 22, 2026 11:17
Copy link
Member

@ok2c ok2c left a comment

Choose a reason for hiding this comment

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

@arturobernalg Please do not forget to update the PR description!

@arturobernalg arturobernalg merged commit b945423 into apache:master Feb 22, 2026
10 checks passed
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.

2 participants