From: Amaury Denoyelle Date: Wed, 2 Dec 2026 15:53:25 +0000 (+0100) Subject: BUG/MINOR: h3: remove ambiguity on NULL X-Git-Url: https://git.kaiwu.me/web/http/static/%7B@url%7D?a=commitdiff_plain;h=1aaceddfbe1370c3a3af31ff618f1c657be7657c;p=haproxy.git BUG/MINOR: h3: remove ambiguity on NULL The h3c member is initialized from the proxy, accessed through the connection target. On the backend side, a server instance is expected. Historically, a connection target could alternatively be set to the proxy itself in specific configurations (dispatch and transparent backends). In practice, these cases were never usable with QUIC. However, the rest of the HAProxy codebase is still written defensively around this case. To remove the current ambiguity, add NULL checks before dereferencing the member in the two h3_stats.c helpers. This must be backported up to 3.3, as this is only relevant since QUIC backend support. --- diff --git a/src/h3_stats.c b/src/h3_stats.c index de94e5c67..75bff5578 100644 --- a/src/h3_stats.c +++ b/src/h3_stats.c @@ -263,6 +263,10 @@ INITCALL1(STG_REGISTER, stats_register_module, &h3_stats_module); void h3_inc_err_cnt(struct h3_counters *ctrs, int error_code) { + /* Only needed for dispatch/option transparent, though such connection cannot carry QUIC/H3. */ + if (!ctrs) + return; + switch (error_code) { case H3_ERR_NO_ERROR: HA_ATOMIC_INC(&ctrs->h3_no_error); @@ -332,6 +336,10 @@ void h3_inc_err_cnt(struct h3_counters *ctrs, int error_code) void h3_inc_frame_type_cnt(struct h3_counters *ctrs, int frm_type) { + /* Only needed for dispatch/option transparent, though such connection cannot carry QUIC/H3. */ + if (!ctrs) + return; + switch (frm_type) { case H3_FT_DATA: HA_ATOMIC_INC(&ctrs->h3_data);