Fix setting identifier truncation in SettingsFrame.serialize_body by bysiber · Pull Request #167 · python-hyper/hyperframe
and others added 2 commits
The bitmask `setting & 0xFF` truncates the 16-bit setting identifier to only 8 bits. This silently corrupts any setting ID above 255 during serialization. The identifier field in SETTINGS frames is 16 bits wide (RFC 9113, Section 6.5.1), and `_STRUCT_HL` already uses the `H` format (unsigned short, 16 bits) for it. However, `& 0xFF` discards the upper byte. For the standard settings (0x01 through 0x08) this has no visible effect since they all fit in 8 bits. But RFC 8701 GREASE values like 0x0a0a or 0x1a1a, as well as any future extension settings > 0xFF, would be silently mangled on a serialize round-trip. Change the mask to `& 0xFFFF` to match the actual field width.
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