Commit fcbe2e6
Fix HC_CALL use-after-free in WinHttpConnection (#929)
WinHttpConnection stored m_call as a raw non-owning HCCallHandle.
After complete_task() calls XAsyncComplete(), the caller may close
the HC_CALL, but outstanding WinHttp callbacks (e.g.
WINHTTP_CALLBACK_STATUS_HANDLE_CLOSING) still access m_call for
trace logging, causing a use-after-free.
Fix: take a refcount on m_call via HCHttpCallDuplicateHandle in the
constructor and release it with HCHttpCallCloseHandle in the
destructor, after WinHttp handles are closed. This matches the
existing ownership pattern used for m_websocketCall.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 2e2f704 commit fcbe2e6
File tree
2 files changed
+4
-2
lines changed- Source/HTTP/WinHttp
2 files changed
+4
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
| 74 | + | |
73 | 75 | | |
74 | 76 | | |
75 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
286 | | - | |
| 286 | + | |
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
| |||
0 commit comments