diff options
author | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2009-12-11 16:42:50 +0000 |
---|---|---|
committer | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2009-12-11 16:42:50 +0000 |
commit | d70bdebcc62f48ae54bb2d7e7216d629bdc5dfcc (patch) | |
tree | 9c0d659870e3e500a4422901d1bb559e9d4fd7f2 /pcre_compile.c | |
parent | b84f61cc8c29b9d3c36794906770fe8b22bf2e0c (diff) | |
download | pcre-d70bdebcc62f48ae54bb2d7e7216d629bdc5dfcc.tar.gz |
Fix options set and reset at top level bug.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@472 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'pcre_compile.c')
-rw-r--r-- | pcre_compile.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/pcre_compile.c b/pcre_compile.c index c360c43..0605a6e 100644 --- a/pcre_compile.c +++ b/pcre_compile.c @@ -5248,7 +5248,7 @@ we set the flag only if there is a literal "\r" or "\n" in the class. */ { cd->external_options = newoptions; } - else + else { if ((options & PCRE_IMS) != (newoptions & PCRE_IMS)) { @@ -5783,6 +5783,7 @@ int branchfirstbyte, branchreqbyte; int length; int orig_bracount; int max_bracount; +int old_external_options = cd->external_options; branch_chain bc; bc.outer = bcptr; @@ -5859,6 +5860,15 @@ for (;;) return FALSE; } + /* If the external options have changed during this branch, it means that we + are at the top level, and a leading option setting has been encountered. We + need to re-set the original option values to take account of this so that, + during the pre-compile phase, we know to allow for a re-set at the start of + subsequent branches. */ + + if (old_external_options != cd->external_options) + oldims = cd->external_options & PCRE_IMS; + /* Keep the highest bracket count in case (?| was used and some branch has fewer than the rest. */ @@ -5969,7 +5979,7 @@ for (;;) PUT(code, 1, code - start_bracket); code += 1 + LINK_SIZE; - /* Resetting option if needed */ + /* Reset options if needed. */ if ((options & PCRE_IMS) != oldims && *ptr == CHAR_RIGHT_PARENTHESIS) { |