From e2d6b400b13cde3cffc1933208399c223459b3ba Mon Sep 17 00:00:00 2001 From: ph10 Date: Wed, 19 Nov 2014 20:57:13 +0000 Subject: [PATCH] Fix zero-repeat assertion condition bug. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1513 2f5784b3-3f2a-0410-8824-cb99058d5e15 Signed-off-by: Petr Písař Petr Pisar: Ported to 8.32. Signed-off-by: Petr Písař --- pcre_exec.c | 4 +++- testdata/testinput2 | 6 ++++++ testdata/testoutput2 | 10 ++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/pcre_exec.c b/pcre_exec.c index 05d0e52..a5326dc 100644 --- a/pcre_exec.c +++ b/pcre_exec.c @@ -1459,7 +1459,9 @@ for (;;) if (md->end_offset_top > offset_top) offset_top = md->end_offset_top; /* Captures may have happened */ condition = TRUE; - ecode += 1 + LINK_SIZE + GET(ecode, LINK_SIZE + 2); + ecode += 1 + LINK_SIZE; + if (*ecode == OP_BRAZERO) ecode++; + ecode += GET(ecode, 1); while (*ecode == OP_ALT) ecode += GET(ecode, 1); } diff --git a/testdata/testinput2 b/testdata/testinput2 index 9670104..0835a98 100644 --- a/testdata/testinput2 +++ b/testdata/testinput2 @@ -3810,4 +3810,10 @@ settings of the anchored and startline bits. --/ /.?/S!I +"((?=(?(?=(?(?=(?(?=())))*)))))" + a + +"(?(?=)?==)(((((((((?=)))))))))" + a + /-- End of testinput2 --/ diff --git a/testdata/testoutput2 b/testdata/testoutput2 index e9cddf8..66c914f 100644 --- a/testdata/testoutput2 +++ b/testdata/testoutput2 @@ -12481,4 +12481,14 @@ No need char Subject length lower bound = -1 No set of starting bytes +"((?=(?(?=(?(?=(?(?=())))*)))))" + a + 0: + 1: + 2: + +"(?(?=)?==)(((((((((?=)))))))))" + a +No match + /-- End of testinput2 --/ -- 1.9.3