Larry Hastings <la...@hastings.org> added the comment:

> Most, if not all, calls to _PyMem_DebugRawRealloc() are protected by
> the GIL. If there is a single thread using the memory block,
> I think that it's perfectly fine to write after it's deallocated.

I don't quite follow where the write-after-free is happening, but: C's free() 
function is *not* protected by the GIL.  So if you're running in a 
multithreaded program where other threads aren't blocked by the GIL, one of 
these other threads could very easily allocate this freshly-freed memory.  And 
if you wrote to it after the memory was allocated to this other thread, 
congrats, your program is no longer correct.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue31626>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to