RFC 9114 forbids the emission of duplicate settings IDs in the same
frame. The receiver may report an error when this occurs.
Settings IDs are expressed as QUIC varint and their range is thus quite
large. As a convenience, only the smallest IDs set is checked, which
matches the most frequent usage.
A mistake in the previous code restricts unnecessarily the check to IDs
less than sizeof long, so typically only IDs from 0 to 7 are really
checked on a 64-bit platform. Fix this by multiplying sizeof() by 8,
covering all IDs up to 63 (31 on a 32-bit platform).
This should be backported up to 2.6 after a period of observation.
*/
/* Ignore duplicate check for ID too big used for GREASE. */
- if (id < sizeof(mask)) {
+ if (id < (8 * sizeof(mask))) {
if (ha_bit_test(id, &mask)) {
h3c->err = H3_ERR_SETTINGS_ERROR;
return -1;