Skip to content

Fixes for heap corruption due to thread safety issue - #718

Open
TomasMorris wants to merge 2 commits into
lexiforest:mainfrom
TomasMorris:tomas_morris/heap_corruption
Open

Fixes for heap corruption due to thread safety issue#718
TomasMorris wants to merge 2 commits into
lexiforest:mainfrom
TomasMorris:tomas_morris/heap_corruption

Conversation

@TomasMorris

Copy link
Copy Markdown

Problem

When curl_easy_perform fails, the handles get deallocated, but the caller of the method then tries to get the cookies from that same memory space, which is a use-after-free issue. This can cause heap corruption errors on Windows (and generally memory errors on any system). There is also a double-free issue with Response._finalize_stream() that can cause concurrent deletes to be possible.

Fix

Added an optional param auto_cleanup that lets the caller avoid cleanup if they intend to use the class after an error

Added general thread safety around curl methods as they are specifically not promised to be thread safe.

@lexiforest

Copy link
Copy Markdown
Owner

Thanks, I'll take a look next week.

@lexiforest lexiforest added this to the 0.16 milestone Apr 1, 2026
@lexiforest lexiforest modified the milestones: 0.16, v0.17 Aug 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants