[issue33742] Unsafe memory access in PyStructSequence_InitType

2018-06-20 Thread Xiang Zhang
Change by Xiang Zhang : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___ ___

[issue33742] Unsafe memory access in PyStructSequence_InitType

2018-06-20 Thread Xiang Zhang
Xiang Zhang 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

[issue33742] Unsafe memory access in PyStructSequence_InitType

2018-06-04 Thread Pasha Stetsenko
Pasha Stetsenko added the comment: The code is simple: ``` // first initialize PyStructSequence_Field* fields; then: PyTypeObject* type = malloc(sizeof(PyTypeObject)); PyStructSequence_InitType(type, desc); ``` Of course, `malloc` can accidentally allocate memory that is already filled with

[issue33742] Unsafe memory access in PyStructSequence_InitType

2018-06-03 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Could you please provide a C code that reproduces the crash? -- components: +Interpreter Core nosy: +serhiy.storchaka versions: +Python 3.8 -Python 3.5 ___ Python tracker

[issue33742] Unsafe memory access in PyStructSequence_InitType

2018-06-03 Thread Pasha Stetsenko
New submission from Pasha Stetsenko : The documentation (https://docs.python.org/3/c-api/tuple.html) for `PyStructSequence_InitType` describes the function as follows: > void PyStructSequence_InitType(PyTypeObject *type, PyStructSequence_Desc > *desc) > Initializes a struct sequence type