dcb3b7
From 7ec44a7b6adbc0221150969fc61134322fd5ed85 Mon Sep 17 00:00:00 2001
dcb3b7
From: Hugo van der Sanden <hv@crypt.org>
dcb3b7
Date: Mon, 12 Dec 2016 15:15:06 +0000
dcb3b7
Subject: [PATCH] Correctly unwind on cache hit
dcb3b7
MIME-Version: 1.0
dcb3b7
Content-Type: text/plain; charset=UTF-8
dcb3b7
Content-Transfer-Encoding: 8bit
dcb3b7
dcb3b7
Petr Pisar: Ported to 5.24.4:
dcb3b7
dcb3b7
commit d3c48e81594c1d64ba9833495e45d8951b42027c
dcb3b7
Author: Hugo van der Sanden <hv@crypt.org>
dcb3b7
Date:   Mon Dec 12 15:15:06 2016 +0000
dcb3b7
dcb3b7
    [perl #130307] Correctly unwind on cache hit
dcb3b7
dcb3b7
    We've already incremented curlyx.count in the WHILEM branch before
dcb3b7
    we check for a hit in the super-linear cache, so must reverse that
dcb3b7
    on the sayNO.
dcb3b7
dcb3b7
Signed-off-by: Petr Písař <ppisar@redhat.com>
dcb3b7
---
dcb3b7
 regexec.c     | 1 +
dcb3b7
 t/re/re_tests | 1 +
dcb3b7
 2 files changed, 2 insertions(+)
dcb3b7
dcb3b7
diff --git a/regexec.c b/regexec.c
dcb3b7
index 6904546..25ea3a3 100644
dcb3b7
--- a/regexec.c
dcb3b7
+++ b/regexec.c
dcb3b7
@@ -7334,6 +7334,7 @@ NULL
dcb3b7
                         DEBUG_EXECUTE_r( Perl_re_exec_indentf( aTHX_  "whilem: (cache) already tried at this position...\n",
dcb3b7
                             depth)
dcb3b7
 			);
dcb3b7
+                        cur_curlyx->u.curlyx.count--;
dcb3b7
 			sayNO; /* cache records failure */
dcb3b7
 		    }
dcb3b7
 		    ST.cache_offset = offset;
dcb3b7
diff --git a/t/re/re_tests b/t/re/re_tests
dcb3b7
index 8b0feaa..6717b85 100644
dcb3b7
--- a/t/re/re_tests
dcb3b7
+++ b/t/re/re_tests
dcb3b7
@@ -1970,6 +1970,7 @@ aa$|a(?R)a|a	aaa	y	$&	aaa		# [perl 128420] recursive matches
dcb3b7
 (?:\1|a)([bcd])\1(?:(?R)|e)\1	abbaccaddedcb	y	$&	abbaccaddedcb		# [perl 128420] recursive match with backreferences
dcb3b7
 (?il)\x{100}|\x{100}|\x{FF}	\xFF	y	$&	\xFF
dcb3b7
 \b\z0*\x{100}	.\x{100}	n	-	-	# [perl #129350] crashed in intuit_start
dcb3b7
+(X{2,}[-X]{1,4}){3,}X{2,}	XXX-XXX-XXX--	n	-	-	# [perl #130307]
dcb3b7
 
dcb3b7
 # Keep these lines at the end of the file
dcb3b7
 # vim: softtabstop=0 noexpandtab
dcb3b7
-- 
dcb3b7
2.14.3
dcb3b7