]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: h3: fix parser desync on error with multiple frames
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 1 Jul 2026 14:19:26 +0000 (16:19 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 3 Jul 2026 06:12:00 +0000 (08:12 +0200)
commit7f416252b524d12865f390d123586df322de9d67
tree0f6769d9d1103dc1d9e70d7915e9d6666ad2b0cf
parentf3411cb734bb9ada5c764b11f6c92a9406773de7
BUG/MEDIUM: h3: fix parser desync on error with multiple frames

On success, h3_rcv_buf() returns the number of parsed STREAM bytes which
are removed by the caller afterwards. A success value is mandatory so
that the underlying QUIC packet is acknowledged.

When H3 parser detects an error during HEADERS or DATA parsing, the
stream or the connetcion is flagged for closure. If there is remaining
frames, they are simply ignored and h3_rcv_buf() returns the remaining
input buffer size.

However, this value is wrong in case one or several frames were already
parsed before the invalid frame in the same h3_rcv_buf() invokation.
This instructs caller to only remove a subset of the data and parsing is
restarted on a random boundary. Most of the times this generates again a
new final yet invalid error, possibly overwriting a stream error with a
full connection closure.

This patch fixes the return value in case of an error during HEADERS or
DATA parsing by ensuring that total variable is always incremented
instead of being directly assigned.

This must be backported up to 2.8.
src/h3.c