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

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