[issue33742] Unsafe memory access in PyStructSequence_InitType
Xiang Zhang
report at bugs.python.org
Wed Jun 20 07:57:36 EDT 2018
Xiang Zhang <angwerzx at 126.com> added the comment:
I don't think here is a problem. It crashes because you preallocate the type object in a wrong way. You should not just does a malloc and then passes it to the API. In this way, you are able to crash many APIs. For example, malloc a dictobject and then pass it to PyDict_SetItem could highly possibly crash. You should use PyDict_New to allocate the dictobject. Also here, you need to use PyType_GenericAlloc(&PyType_Type, 0) to allocate the type object, not just a malloc.
----------
nosy: +xiang.zhang
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33742>
_______________________________________
More information about the Python-bugs-list
mailing list