BUG/MEDIUM: hpack: fix incorrect huffman decoding of some control chars
authorWilly Tarreau <w@1wt.eu>
Thu, 26 Jan 2023 10:12:11 +0000 (11:12 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 26 Jan 2023 10:36:39 +0000 (11:36 +0100)
commit094ecf19f938e9b6c9fb6fcc4fc907776c437d27
tree6335ef16b8080b0d5c99e8367480e3b19a433522
parentb4d119f0c75ce7c5a977ece18dc975e14f9b460c
BUG/MEDIUM: hpack: fix incorrect huffman decoding of some control chars

Commit 9f4f6b038 ("OPTIM: hpack-huff: reduce the cache footprint of the
huffman decoder") replaced the large tables with more space efficient
byte arrays, but one table, rht_bit15_11_11_4, has a 64 bytes hole in it
that wasn't materialized by filling it with zeroes to make the offsets
match, nor by adjusting the offset from the caller. This resulted in
some control chars not properly being decoded and being seen as byte 0,
and the associated messages to be rejected, as can be seen in issue #1971.

This commit fixes it by adjusting the offset used for the higher part of
the table so that we don't need to store 64 zeroes that will never be
accessed.

This needs to be backported to 2.7.

Thanks to Christopher for spotting the bug, and to Juanga Covas for
providing precious traces showing the problem.
src/hpack-huff.c