summaryrefslogtreecommitdiff
path: root/numpy/core/src/arrayobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/core/src/arrayobject.c')
-rw-r--r--numpy/core/src/arrayobject.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c
index 2847b7796..e84ba56fc 100644
--- a/numpy/core/src/arrayobject.c
+++ b/numpy/core/src/arrayobject.c
@@ -9336,7 +9336,14 @@ iter_ass_sub_Bool(PyArrayIterObject *self, PyArrayObject *ind,
"boolean index array should have 1 dimension");
return -1;
}
+
index = ind->dimensions[0];
+ if (index > self->size) {
+ PyErr_SetString(PyExc_ValueError,
+ "boolean index array has too many values");
+ return -1;
+ }
+
strides = ind->strides[0];
dptr = ind->data;
PyArray_ITER_RESET(self);