]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: quic: crash after quic_conn allocation failures
authorFrederic Lecaille <flecaille@haproxy.com>
Wed, 20 Aug 2025 12:48:23 +0000 (14:48 +0200)
committerFrederic Lecaille <flecaille@haproxy.com>
Wed, 20 Aug 2025 14:25:51 +0000 (16:25 +0200)
commit851464784902d4a125c610aea0ec81a8bb07d460
tree689bdb93667c2e6a66734909ef3184e396f673b8
parentc6c2ef1f1189a39fdea429f2792c3bd0a1679a08
BUG/MEDIUM: quic: crash after quic_conn allocation failures

This regression arrived with this commit:

MINOR: quic-be: QUIC connection allocation adaptation (qc_new_conn())

where qc_new_conn() was modified. The ->cids allocation was moved without
checking if a quic_conn_release() call could lead to crashes due to uninitialized
quic_conn members. Indeed, if qc_new_conn() fails, then quic_conn_release() is
called. This bug could impact both QUIC servers and clients.

Such crashes could be reproduced with -dMfail option. To reach them, the
memory allocations must fail. So, this is relatively rare, except on systems
with limited memory.

This patch ensures all the quic_conn members which could lead to crash
from quic_conn_release() are initialized before any remaining memory allocations
required for the quic_conn.

The <conn_id> variable allocated by the client is no more attached to
the connection during its allocation, but after the ->cids trees is allocated.

No backport needed.
src/quic_conn.c