summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Gohlke <cgohlke@uci.edu>2019-02-05 00:38:32 -0800
committerGitHub <noreply@github.com>2019-02-05 00:38:32 -0800
commit97d38d3ba9a215c7cab84202302a12ed1281f050 (patch)
tree335a07235ba3922aadd2eda8ab88e877beb57adf
parentc009e1b98189fc13f78609fdfbb719a1e6b3e385 (diff)
downloadnumpy-97d38d3ba9a215c7cab84202302a12ed1281f050.tar.gz
ENH: do not dereference NULL pointer
The pointer 'current' could be NULL in case the above 'while (current != NULL) {..}' loop finishes without break.
-rw-r--r--numpy/core/src/umath/ufunc_object.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c
index ab986caa1..46aadf2e8 100644
--- a/numpy/core/src/umath/ufunc_object.c
+++ b/numpy/core/src/umath/ufunc_object.c
@@ -5178,7 +5178,7 @@ PyUFunc_RegisterLoopForDescr(PyUFuncObject *ufunc,
}
current = current->next;
}
- if (cmp == 0 && current->arg_dtypes == NULL) {
+ if (cmp == 0 && current != NULL && current->arg_dtypes == NULL) {
current->arg_dtypes = PyArray_malloc(ufunc->nargs *
sizeof(PyArray_Descr*));
if (arg_dtypes != NULL) {