diff options
author | Thomas Köppe <tkoeppe@google.com> | 2017-11-27 17:03:18 +0000 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2017-11-27 11:03:18 -0600 |
commit | 2f366f11466bcac98e2a8c527bc68f20f5d416ff (patch) | |
tree | 4bba53df4ca52ad10dda68ba7dd3736f82f5eb3b | |
parent | 984bc91367f9b525eadef14c48c759999bc4adfc (diff) | |
download | numpy-2f366f11466bcac98e2a8c527bc68f20f5d416ff.tar.gz |
BUG: Fix out-of-bounds access when handling 0d ndarrays (#10101)
-rw-r--r-- | numpy/core/src/multiarray/iterators.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/numpy/core/src/multiarray/iterators.c b/numpy/core/src/multiarray/iterators.c index 1be2eee35..0c83b9387 100644 --- a/numpy/core/src/multiarray/iterators.c +++ b/numpy/core/src/multiarray/iterators.c @@ -243,7 +243,9 @@ array_iter_base_init(PyArrayIterObject *it, PyArrayObject *ao) it->ao = ao; it->size = PyArray_SIZE(ao); it->nd_m1 = nd - 1; - it->factors[nd-1] = 1; + if (nd != 0) { + it->factors[nd-1] = 1; + } for (i = 0; i < nd; i++) { it->dims_m1[i] = PyArray_DIMS(ao)[i] - 1; it->strides[i] = PyArray_STRIDES(ao)[i]; |