File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
numpy/core/src/multiarray Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -2074,6 +2074,11 @@ PyArray_FromInterface(PyObject *origin)
2074
2074
/* Case for data access through pointer */
2075
2075
else if (attr && PyTuple_Check (attr )) {
2076
2076
PyObject * dataptr ;
2077
+ if (n == 0 ) {
2078
+ PyErr_SetString (PyExc_ValueError ,
2079
+ "__array_interface__ shape must be at least size 1" );
2080
+ goto fail ;
2081
+ }
2077
2082
if (PyTuple_GET_SIZE (attr ) != 2 ) {
2078
2083
PyErr_SetString (PyExc_TypeError ,
2079
2084
"__array_interface__ data must be a 2-tuple with "
@@ -2107,6 +2112,11 @@ PyArray_FromInterface(PyObject *origin)
2107
2112
2108
2113
/* Case for data access through buffer */
2109
2114
else {
2115
+ if (n == 0 ) {
2116
+ PyErr_SetString (PyExc_ValueError ,
2117
+ "__array_interface__ shape must be at least size 1" );
2118
+ goto fail ;
2119
+ }
2110
2120
if (attr && (attr != Py_None )) {
2111
2121
base = attr ;
2112
2122
}
You can’t perform that action at this time.
0 commit comments