diff options
author | Stefan van der Walt <stefan@sun.ac.za> | 2007-11-18 20:49:47 +0000 |
---|---|---|
committer | Stefan van der Walt <stefan@sun.ac.za> | 2007-11-18 20:49:47 +0000 |
commit | 7254dd7da0ce26f83b667dcff1fb3b545fb47899 (patch) | |
tree | a47b7f77456284fea58642db081bd6fd2a340b59 /numpy/core/src/arrayobject.c | |
parent | 4ae613d0b53ef17aced122ce8a89274c1ee1ac8e (diff) | |
download | numpy-7254dd7da0ce26f83b667dcff1fb3b545fb47899.tar.gz |
Fix indexing with booleans (patch by Achim Gaedke). Closes #614.
Diffstat (limited to 'numpy/core/src/arrayobject.c')
-rw-r--r-- | numpy/core/src/arrayobject.c | 7 |
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); |