Skip to content

Commit

Permalink
Fix math adding offset to the calculation of memory needed.
Browse files Browse the repository at this point in the history
  • Loading branch information
teoliphant committed Jan 15, 2010
1 parent 5aa1223 commit 137d9e5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions numpy/core/src/multiarray/arrayobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1216,8 +1216,9 @@ array_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds)
dims.ptr[0] = (buffer.len-(intp)offset) / itemsize;
}
else if ((strides.ptr == NULL) &&
(buffer.len < (offset + (intp)itemsize)*
PyArray_MultiplyList(dims.ptr, dims.len))) {
(buffer.len < (offset + (((intp)itemsize)*
PyArray_MultiplyList(dims.ptr,
dims.len))))) {
PyErr_SetString(PyExc_TypeError,
"buffer is too small for " \
"requested array");
Expand Down

0 comments on commit 137d9e5

Please sign in to comment.