Curl_trc_cf_infof dereferences a null cfilter chain during OOM cleanup · Issue #23962 · curl/curl · GitHub
Skip to content 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 Curl_trc_cf_infof dereferences a null cfilter chain during OOM cleanup #23962 New issue Copy link New issue Copy link Closed Closed Curl_trc_cf_infof dereferences a null cfilter chain during OOM cleanup #23962 Copy link Description cmeister2 opened on Nov 15, 2026 Issue body actions I did this I enabled SSL connection-filter tracing with curl_global_trace("ssl") and CURLOPT_VERBOSE .
I installed allocator callbacks with curl_global_init_mem() . The allocator failed one selected positive-size allocation during curl_easy_perform() to a loopback HTTPS listener. On current master, failing allocator call 50 rejected realloc(NULL, 56) in this path: ssl_peer_key_build Curl_ssl_peer_key_make Curl_ssl_peer_init cf_ssl_peer_init AddressSanitizer then reported a read from address 0x2c : Curl_trc_cf_infof gtls_close ssl_cf_destroy Curl_conn_cf_discard_chain Curl_cf_ssl_insert_after This standalone reproducer uses only public libcurl APIs.
OSS-Fuzz also found the same crash in testcase 5432447035310080 . The filter exists when cf_ssl_peer_init() returns CURLE_OUT_OF_MEMORY . It is not attached yet, so cf->chain is NULL . Error cleanup destroys the unattached filter. gtls_close() emits a connection-filter trace, and Curl_trc_cf_infof() evaluates: CF_IS_PRIMARY ( cf ) ? 0 : 1 CF_IS_PRIMARY(cf) dereferences cf->chain->primary . The regression came from commit 123c11cbace4 .
Before that commit, tracing read the zero-initialized cf->sockindex . The trigger requires an allocation failure and enabled SSL connection-filter tracing. Remote input alone did not trigger the crash. I expected the following curl_easy_perform() returns an allocation error, and cleanup does not crash. Curl_trc_cf_infof() can use trace index zero when cf->chain == NULL . This keeps the old trace behavior for unattached filters. curl/libcurl version curl master fdc6688e961e43fdd8e5371de46a2e54e7921581 GnuTLS 3.8.13 operating system Linux phoenix 6.6.114.1-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC Mon Dec 1 20:46:23 UTC 2025 x86_64 GNU/Linux Activity lazerg added a commit that references this issue on Nov 15, 2026 curl_trc: do not access the chain of an unattached filter This issue will close once commit dd50ed3 is merged into the 'master' branch. dd50ed3 bagder closed this as completed in eed87d8 on Nov 16, 2026 vszakats added a commit that references this issue on Nov 16, 2026 curl_trc: do not access the chain of an unattached filter This issue will close once commit eed87d8 is merged into the 'master' branch. eed87d8 Sign up for free to join this conversation on GitHub.
Already have an account? Sign in to comment Metadata Metadata Assignees No one assigned Labels No labels No labels Type No type Projects No projects Milestone No milestone Relationships None yet Development No branches or pull requests Issue actions You can’t perform that action at this time.