Fix regular expression matching

This commit is contained in:
Petr Písař 2016-12-19 13:14:04 +01:00
parent 0b127f245a
commit 7b8c12cb92
2 changed files with 59 additions and 0 deletions

View File

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

View File

@ -241,6 +241,9 @@ Patch63: perl-5.24.0-assertion-failure-in-.-or-0-x-0.patch
# Fix a memory leak in IO::Poll, RT#129788, in upstream after 5.25.7 # Fix a memory leak in IO::Poll, RT#129788, in upstream after 5.25.7
Patch64: perl-5.24.0-perl-129788-IO-Poll-fix-memory-leak.patch Patch64: perl-5.24.0-perl-129788-IO-Poll-fix-memory-leak.patch
# Fix regular expression matching, RT#130307, in upstream after 5.25.7
Patch65: perl-5.25.7-perl-130307-Correctly-unwind-on-cache-hit.patch
# Link XS modules to libperl.so with EU::CBuilder on Linux, bug #960048 # Link XS modules to libperl.so with EU::CBuilder on Linux, bug #960048
Patch200: perl-5.16.3-Link-XS-modules-to-libperl.so-with-EU-CBuilder-on-Li.patch Patch200: perl-5.16.3-Link-XS-modules-to-libperl.so-with-EU-CBuilder-on-Li.patch
@ -2931,6 +2934,7 @@ Perl extension for Version Objects
%patch62 -p1 %patch62 -p1
%patch63 -p1 %patch63 -p1
%patch64 -p1 %patch64 -p1
%patch65 -p1
%patch200 -p1 %patch200 -p1
%patch201 -p1 %patch201 -p1
@ -2986,6 +2990,7 @@ perl -x patchlevel.h \
'Fedora Patch62: Fix const correctness in hv_func.h (RT#130169)' \ 'Fedora Patch62: Fix const correctness in hv_func.h (RT#130169)' \
'Fedora Patch63: Fix a crash in optimized evaluation of "or ((0) x 0))" (RT#130247)' \ 'Fedora Patch63: Fix a crash in optimized evaluation of "or ((0) x 0))" (RT#130247)' \
'Fedora Patch64: Fix a memory leak in IO::Poll (RT#129788)' \ 'Fedora Patch64: Fix a memory leak in IO::Poll (RT#129788)' \
'Fedora Patch65: Fix regular expression matching (RT#130307)' \
'Fedora Patch200: Link XS modules to libperl.so with EU::CBuilder on Linux' \ 'Fedora Patch200: Link XS modules to libperl.so with EU::CBuilder on Linux' \
'Fedora Patch201: Link XS modules to libperl.so with EU::MM on Linux' \ 'Fedora Patch201: Link XS modules to libperl.so with EU::MM on Linux' \
%{nil} %{nil}
@ -5267,6 +5272,7 @@ popd
* Mon Dec 19 2016 Petr Pisar <ppisar@redhat.com> - 4:5.24.0-382 * Mon Dec 19 2016 Petr Pisar <ppisar@redhat.com> - 4:5.24.0-382
- Fix a crash in optimized evaluation of "or ((0) x 0))" (RT#130247) - Fix a crash in optimized evaluation of "or ((0) x 0))" (RT#130247)
- Fix a memory leak in IO::Poll (RT#129788) - Fix a memory leak in IO::Poll (RT#129788)
- Fix regular expression matching (RT#130307)
* Thu Dec 01 2016 Petr Pisar <ppisar@redhat.com> - 4:5.24.0-381 * Thu Dec 01 2016 Petr Pisar <ppisar@redhat.com> - 4:5.24.0-381
- Fix crash in Storable when deserializing malformed code reference - Fix crash in Storable when deserializing malformed code reference