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