From: Amaury Denoyelle Date: Wed, 18 Nov 2026 15:50:24 +0000 (+0100) Subject: BUG/MINOR: quic: do not reject CRYPTO data exactly fitting in buffer X-Git-Url: https://git.kaiwu.me/http/%22data:,/$%7BISSUES%7D/static/gitweb.js?a=commitdiff_plain;h=a0858751a61263c8d9ffda1a9d481bc03163d6bb;p=haproxy.git BUG/MINOR: quic: do not reject CRYPTO data exactly fitting in buffer CRYPTO data buffering does not support wrapping of data. A BUG_ON() ensures data never wraps during SSL read operations. This can never fire as a similar comparison exists first in CRYPTO parsing to reject wrapping content. However, this code uses an incorrect greater-than-or-equal operator on buffer wrapping. This incorrectly rejects CRYPTO content that exactly fits in the receive buffer and closes connection. Fixes the comparison operators so that CRYPTO data ending exactly at the buffer end can now be normally handled. This should be backported up to 2.6 after a period of observation. --- diff --git a/src/quic_rx.c b/src/quic_rx.c index 2cc920d8e..6eaaf646c 100644 --- a/src/quic_rx.c +++ b/src/quic_rx.c @@ -766,7 +766,7 @@ static int qc_handle_crypto_frm(struct quic_conn *qc, * ha_quic_ossl_crypto_recv_rcd()/qc_ssl_provide_all_quic_data(). * TODO implement proper support for CRYPTO wrapping. */ - if (ncbmb_head(ncbuf) + data >= ncbmb_wrap(ncbuf)) { + if (ncbmb_head(ncbuf) + data > ncbmb_wrap(ncbuf)) { TRACE_ERROR("unsupported wrapping CRYPTO frames", QUIC_EV_CONN_PRSHPKT, qc); COUNT("connection closed on unsupported wrapping CRYPTO content"); quic_set_connection_close(qc, quic_err_transport(QC_ERR_CRYPTO_BUFFER_EXCEEDED)); diff --git a/src/quic_ssl.c b/src/quic_ssl.c index 425a4333a..5f1fc9687 100644 --- a/src/quic_ssl.c +++ b/src/quic_ssl.c @@ -507,7 +507,7 @@ static int ha_quic_ossl_crypto_recv_rcd(SSL *ssl, /* must not be released at this time. */ cdata = (const unsigned char *)ncbmb_head(ncbuf); /* Currently wrapping CRYPTO content is not supported and rejected on frame reception. */ - BUG_ON(cdata + data >= (const unsigned char *)ncbmb_wrap(ncbuf)); + BUG_ON(cdata + data > (const unsigned char *)ncbmb_wrap(ncbuf)); cstream->rx.offset += data; TRACE_DEVEL("buffered crypto data were provided to TLS stack", @@ -1202,7 +1202,7 @@ int qc_ssl_provide_all_quic_data(struct quic_conn *qc, struct ssl_sock_ctx *ctx) while ((data = ncbmb_data(ncbuf, 0))) { const unsigned char *cdata = (const unsigned char *)ncbmb_head(ncbuf); /* Currently wrapping CRYPTO content is not supported and rejected on frame reception. */ - BUG_ON(cdata + data >= (const unsigned char *)ncbmb_wrap(ncbuf)); + BUG_ON(cdata + data > (const unsigned char *)ncbmb_wrap(ncbuf)); if (!qc_ssl_provide_quic_data(&qel->cstream->rx.ncbuf, qel->level, ctx, cdata, data))