]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: qpack: fix huff_dec() error handling in qpack_decode_fs()
authorFrederic Lecaille <flecaille@haproxy.com>
Wed, 27 May 2026 15:16:16 +0000 (17:16 +0200)
committerFrederic Lecaille <flecaille@haproxy.com>
Wed, 27 May 2026 16:40:53 +0000 (18:40 +0200)
commit8874f06b9ef9dcece53210b16f5677a7c81c1e78
treefcc44af36142b71b064f977712034526f8eaac59
parent629fbee3be76d63e12b8b715c0b990b4eb863fd2
BUG/MINOR: qpack: fix huff_dec() error handling in qpack_decode_fs()

The <nlen> variable is a signed integer, but the check for a Huffman
decoding error was written as 'nlen == (uint32_t)-1'.

With standard compiler type promotion rules, this comparison happens to
work as intended when huff_dec() returns -1. However, relying on implicit
unsigned promotions for signed error checking is fragile. If a compiler
applies different promotion semantics, or if huff_dec() returns any other
negative error code, the failure would go undetected, leading to buffer
corruption or a crash via b_add() and ist2().

Fix this by using 'nlen < 0', removing any ambiguity regardless of the
compiler used.

Must be backported to all versions.
src/qpack-dec.c