[issue31626] Writing in freed memory in _PyMem_DebugRawRealloc() after shrinking a memory block

STINNER Victor report at bugs.python.org
Wed Oct 25 09:55:11 EDT 2017


STINNER Victor <victor.stinner at gmail.com> added the comment:

> Using nested _PyMem_DebugRawRealloc() looks suspicions to me. This may be a bug.

PyObject_Malloc() calls PyMem_RawMalloc() for allocations larger than 512 bytes.

When debug hooks are enabled, PyObject_Malloc() and PyMem_RawMalloc() both call _PyMem_DebugRawRealloc(). The behaviour that you saw is expected.

It was simpler to reuse _PyMem_DebugRawRealloc() PyObject and PyMem_Raw allocator families, rather than duplicating the code.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31626>
_______________________________________


More information about the Python-bugs-list mailing list