diff options
| author | Sebastian Berg <sebastian@sipsolutions.net> | 2018-12-17 12:33:15 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-12-17 12:33:15 +0100 |
| commit | 41d5a9fed1fb0308ca3eba6cb26c1933653169b7 (patch) | |
| tree | 82c4023f361dcef7ef002b45acf602091cefd190 /numpy/core/src | |
| parent | 38236fb225418ad5979511e3caf7e992df72b1a7 (diff) | |
| parent | d5200bdd2f9274ab95d4f5882e9ca80aa4d4e8da (diff) | |
| download | numpy-41d5a9fed1fb0308ca3eba6cb26c1933653169b7.tar.gz | |
Merge pull request #12546 from mattip/dtype-err-check
BUG: check for errors after PyArray_DESCR_REPLACE
Diffstat (limited to 'numpy/core/src')
| -rw-r--r-- | numpy/core/src/multiarray/descriptor.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/numpy/core/src/multiarray/descriptor.c b/numpy/core/src/multiarray/descriptor.c index b9be3c09f..3038e4dea 100644 --- a/numpy/core/src/multiarray/descriptor.c +++ b/numpy/core/src/multiarray/descriptor.c @@ -257,6 +257,9 @@ _convert_from_tuple(PyObject *obj, int align) return NULL; } PyArray_DESCR_REPLACE(type); + if (type == NULL) { + return NULL; + } if (type->type_num == NPY_UNICODE) { type->elsize = itemsize << 2; } @@ -1651,6 +1654,9 @@ finish: if (PyDataType_ISUNSIZED(*at) && (*at)->elsize != elsize) { PyArray_DESCR_REPLACE(*at); + if (*at == NULL) { + goto error; + } (*at)->elsize = elsize; } if (endian != '=' && PyArray_ISNBO(endian)) { @@ -1659,6 +1665,9 @@ finish: if (endian != '=' && (*at)->byteorder != '|' && (*at)->byteorder != endian) { PyArray_DESCR_REPLACE(*at); + if (*at == NULL) { + goto error; + } (*at)->byteorder = endian; } return NPY_SUCCEED; |
