You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Curl_connect() tries to close an in-use HTTP/2 connection after OOM #23629
If setup_range() returns CURLE_OUT_OF_MEMORY after a transfer attaches to a multiplexed HTTP/2 connection, Curl_connect() detaches that transfer and calls Curl_conn_close(..., TRUE) while another transfer still owns the connection.
Current master asserts in cpool_discard_conn(); at curl 62a6ee5f, the same reproducer produces an ASan heap-use-after-free.
After detaching, Curl_connect() should only close the connection when !CONN_INUSE(conn).
The client exits with status 134 (SIGABRT). The first line confirms the intended setup_range() allocation was rejected; the assertion confirms curl then tried to discard a connection still owned by another transfer.
Against curl 62a6ee5 (i.e. pre-debugassert), the assertion is absent and ASan instead reports:
ERROR: AddressSanitizer: heap-use-after-free
READ in mstate_perform_pollset
...
freed by Curl_conn_free
cpool_discard_conn
Curl_conn_close
Curl_connect
Activity
cmeister2 commentedon Oct 27, 2026
Running the attachments against current ASan/debug curl gives:
Server terminal:
Client terminal:
The client exits with status 134 (SIGABRT). The first line confirms the intended setup_range() allocation was rejected; the assertion confirms curl then tried to discard a connection still owned by another transfer.
Against curl 62a6ee5 (i.e. pre-debugassert), the assertion is absent and ASan instead reports:
ERROR: AddressSanitizer: heap-use-after-free READ in mstate_perform_pollset ... freed by Curl_conn_free cpool_discard_conn Curl_conn_close Curl_connectbagder commentedon Oct 27, 2026
While a UAF, I don't think we need to treat this as a vulnerability.
Reasons:
cmeister2 commentedon Oct 27, 2026
Also worth mentioning this was discovered by OSS-Fuzz: https://issues.oss-fuzz.com/issues/578324120
bagder commentedon Oct 27, 2026
When I remove the assert from the code in master I "only" get a memory leak instead. I think maybe @icing has an idea on the best fix here?
icing commentedon Oct 28, 2026
I think I can propose a PR for fixing this happy little accident.
connection close: additional checks