From 99a509de7e6dce381e8bc23c5d080f8c8e5c5e12 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Mon, 2 Feb 2015 17:40:03 +0100 Subject: [PATCH] python: Fix out of bounds access on unmatched Cython array declaration --- tagmanager/ctags/python.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tagmanager/ctags/python.c b/tagmanager/ctags/python.c index 6c32b03f..cc9d7d15 100644 --- a/tagmanager/ctags/python.c +++ b/tagmanager/ctags/python.c @@ -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 == '(') {