diff options
author | Julian Taylor <juliantaylor108@gmail.com> | 2013-11-16 02:24:30 -0800 |
---|---|---|
committer | Julian Taylor <juliantaylor108@gmail.com> | 2013-11-16 02:24:30 -0800 |
commit | 2c02016111f05a040ef7fe97f3455d355077c1d4 (patch) | |
tree | e48eb587586fa4ae91d8e5caf6064b3ab4d34c2a | |
parent | 6eb4a4318bddd6105e91f962dec4a5590f524d02 (diff) | |
parent | a0568165ecc19a60eb47e1b936a0c7c0a1e83501 (diff) | |
download | numpy-2c02016111f05a040ef7fe97f3455d355077c1d4.tar.gz |
Merge pull request #4020 from juliantaylor/memcrash
BUG: fix missing check for memory allocation failure in ufuncs
-rw-r--r-- | numpy/core/src/umath/ufunc_object.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c index 866ec642a..906b8214c 100644 --- a/numpy/core/src/umath/ufunc_object.c +++ b/numpy/core/src/umath/ufunc_object.c @@ -1437,6 +1437,9 @@ execute_legacy_ufunc_loop(PyUFuncObject *ufunc, PyArray_ISFORTRAN(op[0]) ? NPY_ARRAY_F_CONTIGUOUS : 0, NULL); + if (op[1] == NULL) { + return -1; + } /* Call the __prepare_array__ if necessary */ if (prepare_ufunc_output(ufunc, &op[1], @@ -1489,6 +1492,9 @@ execute_legacy_ufunc_loop(PyUFuncObject *ufunc, PyArray_ISFORTRAN(tmp) ? NPY_ARRAY_F_CONTIGUOUS : 0, NULL); + if (op[2] == NULL) { + return -1; + } /* Call the __prepare_array__ if necessary */ if (prepare_ufunc_output(ufunc, &op[2], |