From fb774225c09cdb4848026167035596f502f28a5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Mon, 26 Oct 2015 10:17:01 +0100 Subject: [PATCH] Fix PCRE2_NO_AUTO_CAPTURE bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Upstream commit ported to 10.20: From 0536f51c8511921664d1dbfa7fbc156d0d687942 Mon Sep 17 00:00:00 2001 From: ph10 Date: Sun, 25 Oct 2015 17:35:34 +0000 Subject: [PATCH] Fix PCRE2_NO_AUTO_CAPTURE bug. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@393 6239d852-aaf2-0410-a92c-79f79f948069 Signed-off-by: Petr Písař --- src/pcre2_compile.c | 7 ++++--- testdata/testinput2 | 4 ++++ testdata/testoutput2 | 6 ++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c index 5d3584d..13febc9 100644 --- a/src/pcre2_compile.c +++ b/src/pcre2_compile.c @@ -3326,9 +3326,10 @@ for (; ptr < cb->end_pattern; ptr++) if (ptr[1] != CHAR_QUESTION_MARK) { - if (ptr[1] != CHAR_ASTERISK && - (options & PCRE2_NO_AUTO_CAPTURE) == 0) - cb->bracount++; /* Capturing group */ + if (ptr[1] != CHAR_ASTERISK) + { + if ((options & PCRE2_NO_AUTO_CAPTURE) == 0) cb->bracount++; + } else /* (*something) - just skip to closing ket */ { ptr += 2; diff --git a/testdata/testinput2 b/testdata/testinput2 index dc64019..35ebe47 100644 --- a/testdata/testinput2 +++ b/testdata/testinput2 @@ -4329,4 +4329,8 @@ a random value. /Ix /^(o(\1{72}{\"{\\{00000059079}\d*){74}}){19}/I +/((p(?'K/ + +/((p(?'K/no_auto_capture + # End of testinput2 diff --git a/testdata/testoutput2 b/testdata/testoutput2 index cfc3ef0..3fdbc1f 100644 --- a/testdata/testoutput2 +++ b/testdata/testoutput2 @@ -14478,4 +14478,10 @@ Overall options: anchored Last code unit = '}' Subject length lower bound = 52629 +/((p(?'K/ +Failed: error 142 at offset 7: syntax error in subpattern name (missing terminator) + +/((p(?'K/no_auto_capture +Failed: error 142 at offset 7: syntax error in subpattern name (missing terminator) + # End of testinput2 -- 2.4.3