]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: qpack: fix 1-byte OOB read in qpack_decode_fs_pfx()
authorFrederic Lecaille <flecaille@haproxy.com>
Wed, 4 Mar 2026 13:10:49 +0000 (14:10 +0100)
committerFrederic Lecaille <flecaille@haproxy.com>
Thu, 5 Mar 2026 14:02:02 +0000 (15:02 +0100)
commit54b614d2b51930af366ffeff4d48158abc3f8077
treebe1272a20393723f93aa0062a14ac2f4384c260d
parente38b86e72c0a587b6311a56d45cd8c22286d2c8f
BUG/MINOR: qpack: fix 1-byte OOB read in qpack_decode_fs_pfx()

In qpack_decode_fs_pfx(), if the first qpack_get_varint() call
consumes the entire buffer, the code would perform a 1-byte
out-of-bounds read when accessing the sign bit via **raw.

This patch adds an explicit length check at the beginning of
qpack_get_varint(), which systematically secures all other callers
against empty inputs. It also adds a necessary check before the
second varint call in qpack_decode_fs_pfx() to ensure data is still
available before dereferencing the pointer to extract the sign bit,
returning QPACK_RET_TRUNCATED if the buffer is exhausted.

Thank you to Kamil Frankowicz for having reported this.

Must be backported as far as 2.6.
src/qpack-dec.c