pcre/pcre-8.40-Fix-DFA-match-handling-of-possessive-repeated-charac.patch

68 lines
2.1 KiB
Diff

From 881b9580da401953f2a94b42cb9cc275b4719341 Mon Sep 17 00:00:00 2001
From: ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>
Date: Wed, 22 Mar 2017 15:17:45 +0000
Subject: [PATCH] Fix DFA match handling of possessive repeated character class
(Bugzilla 2086).
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@1689 2f5784b3-3f2a-0410-8824-cb99058d5e15
Petr Písař: Ported to 8.40.
---
pcre_dfa_exec.c | 4 ++--
testdata/testinput8 | 3 +++
testdata/testoutput8 | 4 ++++
diff --git a/pcre_dfa_exec.c b/pcre_dfa_exec.c
index 170ce6a..bc09ced 100644
--- a/pcre_dfa_exec.c
+++ b/pcre_dfa_exec.c
@@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language (but see
below for why this module is different).
Written by Philip Hazel
- Copyright (c) 1997-2014 University of Cambridge
+ Copyright (c) 1997-2017 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -2625,7 +2625,7 @@ for (;;)
if (isinclass)
{
int max = (int)GET2(ecode, 1 + IMM2_SIZE);
- if (*ecode == OP_CRPOSRANGE)
+ if (*ecode == OP_CRPOSRANGE && count >= (int)GET2(ecode, 1))
{
active_count--; /* Remove non-match possibility */
next_active_state--;
diff --git a/testdata/testinput8 b/testdata/testinput8
index 7f8fa82..e931410 100644
--- a/testdata/testinput8
+++ b/testdata/testinput8
@@ -4845,4 +4845,7 @@
aaa\D
a\D
+/(02-)?[0-9]{3}-[0-9]{3}/
+ 02-123-123
+
/-- End of testinput8 --/
diff --git a/testdata/testoutput8 b/testdata/testoutput8
index 17b667a..4984376 100644
--- a/testdata/testoutput8
+++ b/testdata/testoutput8
@@ -7801,4 +7801,8 @@ No match
** Show all captures ignored after DFA matching
0: a
+/(02-)?[0-9]{3}-[0-9]{3}/
+ 02-123-123
+ 0: 02-123-123
+
/-- End of testinput8 --/
--
2.7.4