ctypes.Pointer.get_contents
doesn't hold the object's lock for long enough
#131974
Labels
ctypes.Pointer.get_contents
doesn't hold the object's lock for long enough
#131974
Bug report
Bug description:
As @kumaraditya303 mentioned,
ctypes.Pointer.get_contents
has a thread safety bug that I missed when I originally fixed it.cpython/Modules/_ctypes/_ctypes.c
Lines 5413 to 5430 in 3b3720f
Dereferencing the pointer is locked, but it's unsafe to call
PyCData_FromBaseObj
without holding the lock, because the pointer might be invalidated concurrently. I suspect this kind of bug exists with other uses oflocked_deref
too.CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
locked_deref
inctypes
#131975The text was updated successfully, but these errors were encountered: