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
object:memoryview pass a temporary buffer for the format to PyMemoryView_FromBuffer. By reading the source code of this function, it does not "strdup" this format string, so it supposes it's always valid.
Hard to reproduce, as it's an use-after-free problem. Basically, creates a memoryview with a given format, and in some cases the format within the Python object will be wrong!
The text was updated successfully, but these errors were encountered:
Issue description
object:memoryview
pass a temporary buffer for the format toPyMemoryView_FromBuffer
. By reading the source code of this function, it does not "strdup
" this format string, so it supposes it's always valid.It is not really clear in the documentation how ownership works for the format. I figured this out because I had broken format issues with memory views in https://github.com/aguinet/dragonffi/ . A temporary fix by using
strdup
here https://github.com/aguinet/dragonffi/blob/master/third-party/pybind11/pytypes.h#L1255 fix the problem, but leaks memory.Reproducible example code
Hard to reproduce, as it's an use-after-free problem. Basically, creates a memoryview with a given format, and in some cases the format within the Python object will be wrong!
The text was updated successfully, but these errors were encountered: