]> git.kaiwu.me - haproxy.git/commit
BUG/MINOR: qpack: missing shift count check in qpack_get_varint() (UB)
authorFrederic Lecaille <flecaille@haproxy.com>
Fri, 14 Aug 2026 13:26:05 +0000 (15:26 +0200)
committerFrederic Lecaille <flecaille@haproxy.com>
Fri, 14 Aug 2026 13:28:22 +0000 (15:28 +0200)
commit574aa9853cd37f4226cdc166c8e24408fad64202
treebe2f0420d90d7f3f8bbc476298c13f8c655fedca
parent23a2811b672b06103b1185ee3a49d6c157478097
BUG/MINOR: qpack: missing shift count check in qpack_get_varint() (UB)

Parsing QPACK varints with excessive continuation bytes increases shift
by 7 on each iteration. When shift reaches 63 or higher, evaluating:

    (v & 127) > (limit - ret) >> shift

executes a bitwise shift on a 64-bit integer with an out-of-range count,
which is Undefined Behavior in C.

Fix this by jumping to too_large label if shift >= 63 before the shift runs.

Thank you to @OneZ3r0 for having reported this issue.

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