[New-bugs-announce] [issue7063] Memory errors in array.array
Jan Hosang
report at bugs.python.org
Mon Oct 5 10:12:29 CEST 2009
New submission from Jan Hosang <jan.hosang at gmail.com>:
While I was backporting the new buffer API to 2.7 I noticed some issues
in array_ass_slice() in Modules/arraymodule.c in the python 3k branch.
1) Manual memory reallocation had been replaced by calls to
array_resize. But I think when PyMem_RESIZE is called the pointer to the
memory might change. So this now happens in array_resize, and the
array->ob_item pointer changes but not it's local copy (item) in
array_ass_slice().
2) The function moves too much memory if the array size is increased:
(Py_SIZE(a)-d-ihigh) items should be moved, because Py_SIZE(a) was
already modified by array_resize, but the function moves (Py_SIZE(a)-
ihigh) items.
While 1) might go unnoticed, 2) definitely broke slice tests in a
"segmentation fault"-way (in debug mode forbidden bits show the error).
I tried to write a test, but I don't know how to trigger
array_ass_slice() with a write access, as it is not in array_as_sequence
anymore (like in 2.7). How is slicing handled now?
----------
components: Library (Lib), Tests
messages: 93581
nosy: chuck
severity: normal
status: open
title: Memory errors in array.array
versions: Python 3.2
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7063>
_______________________________________
More information about the New-bugs-announce
mailing list