summaryrefslogtreecommitdiffstats
path: root/Modules/arraymodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/arraymodule.c')
-rw-r--r--Modules/arraymodule.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index c1a0f53..b24b4c9 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -1699,6 +1699,16 @@ array_ass_subscr(arrayobject* self, PyObject* item, PyObject* value)
if ((step > 0 && stop < start) ||
(step < 0 && stop > start))
stop = start;
+
+ /* Issue #4509: If the array has exported buffers and the slice
+ assignment would change the size of the array, fail early to make
+ sure we don't modify it. */
+ if ((needed == 0 || slicelength != needed) && self->ob_exports > 0) {
+ PyErr_SetString(PyExc_BufferError,
+ "cannot resize an array that is exporting buffers");
+ return -1;
+ }
+
if (step == 1) {
if (slicelength > needed) {
memmove(self->ob_item + (start + needed) * itemsize,
urssummarylogtree crossarm.git[no description]2 yearssummarylogtree crossppc.git[no description]6 yearssummarylogtree cv2pdb.git3 yearssummarylogtree gcc-compiler-suite.gitThis is the repo to build the complete GCC+gdb suite: - nativ 64-Bit multilib co...2 monthssummarylogtree googletest.gitGoogle's C++ test framework: https://github.com/google/googletest31 hourssummarylogtree hdf5.gitMirror from: https://github.com/HDFGroup/hdf5.git23 monthssummarylogtree jemalloc.gitjemalloc is a general purpose malloc(3) implementation that emphasizes fragmenta...9 monthssummarylogtree libart.git[no description]5 yearssummarylogtree libnl.git[no description]9 weekssummarylogtree libpcap.gitlibpcap is a system-independent interface for user-level packet capture.5 yearssummarylogtree lz4.gitLZ4 is lossless compression algorithm, providing compression speed > 500 MB/s pe...