diff options
author | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2015-11-26 20:29:13 +0000 |
---|---|---|
committer | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2015-11-26 20:29:13 +0000 |
commit | 3c80e02cd464ea049e117b423fd48fab294c51a9 (patch) | |
tree | 9f195302c4fe1c215dadb275b9d0541a7061602c /pcre_compile.c | |
parent | bb522f07121a0c5796fc73fb5824f8ba1b6aa5c8 (diff) | |
download | pcre-3c80e02cd464ea049e117b423fd48fab294c51a9.tar.gz |
Fix auto-callout (?# comment bug.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1611 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'pcre_compile.c')
-rw-r--r-- | pcre_compile.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/pcre_compile.c b/pcre_compile.c index 4d3b313..3360a8b 100644 --- a/pcre_compile.c +++ b/pcre_compile.c @@ -4699,6 +4699,23 @@ for (;; ptr++) } } + /* Skip over (?# comments. We need to do this here because we want to know if + the next thing is a quantifier, and these comments may come between an item + and its quantifier. */ + + if (c == CHAR_LEFT_PARENTHESIS && ptr[1] == CHAR_QUESTION_MARK && + ptr[2] == CHAR_NUMBER_SIGN) + { + ptr += 3; + while (*ptr != CHAR_NULL && *ptr != CHAR_RIGHT_PARENTHESIS) ptr++; + if (*ptr == CHAR_NULL) + { + *errorcodeptr = ERR18; + goto FAILED; + } + continue; + } + /* See if the next thing is a quantifier. */ is_quantifier = @@ -6529,21 +6546,6 @@ for (;; ptr++) case CHAR_LEFT_PARENTHESIS: ptr++; - /* First deal with comments. Putting this code right at the start ensures - that comments have no bad side effects. */ - - if (ptr[0] == CHAR_QUESTION_MARK && ptr[1] == CHAR_NUMBER_SIGN) - { - ptr += 2; - while (*ptr != CHAR_NULL && *ptr != CHAR_RIGHT_PARENTHESIS) ptr++; - if (*ptr == CHAR_NULL) - { - *errorcodeptr = ERR18; - goto FAILED; - } - continue; - } - /* Now deal with various "verbs" that can be introduced by '*'. */ if (ptr[0] == CHAR_ASTERISK && (ptr[1] == ':' |