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

Serhiy Storchaka report at bugs.python.org
Wed Oct 25 12:09:22 EDT 2017


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

In this case it would be safe to not erase bytes at all.

PR 4119 is too complex for a bugfix (especially if backport it to 3.5 and 3.4). It can introduce other regressions. The performance hit is not the only issue. Allocating a temporary buffer can change the structure of "holes" in memory. As result some memory related bugs can be reproducible only in release mode.

Maybe it is enough to erase only few bytes at the start and end of the freed area. The copy can be saved in local variables, without involving the heap. This solution still will be enough complex, and I think it can be applied only to 3.7. But the bug should be fixed in all affected versions.

----------

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


More information about the Python-bugs-list mailing list