BUG/MAJOR: mux-quic: fix BUG_ON on empty STREAM emission
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 31 Dec 2024 14:21:19 +0000 (15:21 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 6 Jan 2025 10:32:04 +0000 (11:32 +0100)
commit535b984d3bea70defb7a81baba9bff683c7add59
treede2f2050d1b2e6b3ced9901f28d5812a49fcc04b
parent29b1710c9a86fb41f1c322f68a90d199298696f1
BUG/MAJOR: mux-quic: fix BUG_ON on empty STREAM emission

A BUG_ON() is present in qcc_io_send() to ensure that encoded frame list
is empty if qcc_build_frms() previously returned 0.

This BUG_ON() may be triggered if empty STREAM frame is encoded for
standalone FIN. Indeed, qcc_build_frms() returns the sum of all STREAM
payload length. In case only empty STREAM frames are generated, return
value will be 0, despite new frames encoded and inserted into frame
list.

To fix this, change return value of qcs_send(). This now returns the
whole STREAM frame length, both header and payload included. This
ensures that qcc_build_frms() won't return a nul value if new frames are
encoded, even empty ones.

This must be backported up to 3.1.

(cherry picked from commit 98064537423fafe05b9ddd97e81cedec8b6b278d)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
src/mux_quic.c