Commit af84643
committed
Mask reserved bit when parsing GoAway and WindowUpdate frames
GoAwayFrame.serialize_body already masks last_stream_id with
& 0x7FFFFFFF, but parse_body reads the raw 32-bit value without
stripping the reserved top bit. If a peer happens to set that bit,
last_stream_id would be read as a value >= 2^31 instead of the
actual stream ID.
Similarly, WindowUpdateFrame.serialize_body masks window_increment
with & 0x7FFFFFFF, but parse_body doesn't. If the reserved bit is
set, the unmasked value exceeds 2^31-1 and the frame is rejected
with InvalidDataError — even though RFC 9113 Section 6.9 says the
reserved bit "MUST be ignored when receiving."
The rest of the codebase already follows this pattern:
- Frame.parse_frame_header masks stream_id & 0x7FFFFFFF
- Priority.parse_priority_data masks depends_on & 0x7FFFFFFF
Add the same mask to GoAwayFrame.parse_body and
WindowUpdateFrame.parse_body for consistency.1 parent b57beaf commit af84643
1 file changed
+3
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
636 | 636 | | |
637 | 637 | | |
638 | 638 | | |
| 639 | + | |
639 | 640 | | |
640 | 641 | | |
641 | 642 | | |
| |||
687 | 688 | | |
688 | 689 | | |
689 | 690 | | |
| 691 | + | |
| 692 | + | |
690 | 693 | | |
691 | 694 | | |
692 | 695 | | |
| |||
0 commit comments