python: Fix out of bounds access on unmatched Cython array declaration

This commit is contained in:
Colomban Wendling 2015-02-02 17:40:03 +01:00
parent 0a97439701
commit 99a509de7e

View File

@ -622,9 +622,11 @@ static const char *skipTypeDecl (const char *cp, boolean *is_class)
while (*ptr && *ptr != '=' && *ptr != '(' && !isspace(*ptr)) {
/* skip over e.g. 'cpdef numpy.ndarray[dtype=double, ndim=1]' */
if(*ptr == '[') {
while(*ptr && *ptr != ']') ptr++;
while (*ptr && *ptr != ']') ptr++;
if (*ptr) ptr++;
} else {
ptr++;
}
ptr++;
}
if (!*ptr || *ptr == '=') return NULL;
if (*ptr == '(') {