]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MAJOR: mux-quic: fail on impossible data transfers in rcv_buf()
authorWilly Tarreau <w@1wt.eu>
Tue, 17 Nov 2026 16:55:22 +0000 (17:55 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 17 Nov 2026 17:38:15 +0000 (18:38 +0100)
When some data couldn't be transferred from the rxbuf to the channel,
leaving the channel empty (e.g. due to the reserve), we must not set
SE_FL_WANT_ROOM otherwise we cannot get out of this situation and
sc_conn_recv() detects it and panics. Let's just report a stream
error for non-fragmentable contents that exceed the maximum size
and stop here.

This must be backported to all versions.

src/mux_quic.c

index 89770d37fccc79387f1ad64f6761e35014c8cf78..b41eedb3141312160ab0c1ac9f6833b126a440c4 100644 (file)
@@ -4523,7 +4523,18 @@ static size_t qcm_strm_rcv_buf(struct stconn *sc, struct buffer *buf,
        ret = qcs_http_rcv_buf(qcs, buf, count, &fin);
 
        if (b_data(&qcs->rx.app_buf)) {
-               se_fl_set(qcs->sd, SE_FL_RCV_MORE | SE_FL_WANT_ROOM);
+               if (b_data(buf))
+                       se_fl_set(qcs->sd, SE_FL_RCV_MORE | SE_FL_WANT_ROOM);
+               else {
+                       /* we have pending data and the output buf is empty,
+                        * this is typical of too large a non-fragmentable
+                        * data (e.g headers, trailers) combined with a
+                        * reserve, so this will never unblock.
+                        */
+                       TRACE_STATE("report xfer error", QMUX_EV_STRM_RECV, qcc->conn, qcs);
+                       se_fl_set(qcs->sd, SE_FL_ERROR);
+                       goto leave;
+               }
        }
        else {
                se_fl_clr(qcs->sd, SE_FL_RCV_MORE | SE_FL_WANT_ROOM);
@@ -4584,7 +4595,7 @@ static size_t qcm_strm_rcv_buf(struct stconn *sc, struct buffer *buf,
                        tasklet_wakeup(qcc->wait_event.tasklet);
                }
        }
-
+leave:
        TRACE_LEAVE(QMUX_EV_STRM_RECV, qcc->conn, qcs);
 
        return ret;