Fix a crash when a match for inversely repeated group fails
This commit is contained in:
parent
bc8f6a5d83
commit
f46fc910fa
@ -0,0 +1,69 @@
|
||||
From af6344c9702b589162d8672ae24130231698acae Mon Sep 17 00:00:00 2001
|
||||
From: Yves Orton <demerphq@gmail.com>
|
||||
Date: Sun, 10 Sep 2017 10:59:05 +0200
|
||||
Subject: [PATCH] fix #132017 - OPFAIL insert needs to set flags to 0
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
why reginsert doesnt do this stuff I dont know.
|
||||
|
||||
Petr Písař: Ported to 5.26.1.
|
||||
|
||||
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
||||
---
|
||||
regcomp.c | 6 +++++-
|
||||
t/re/pat.t | 5 ++++-
|
||||
2 files changed, 9 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/regcomp.c b/regcomp.c
|
||||
index b2de7f0..1df3df8 100644
|
||||
--- a/regcomp.c
|
||||
+++ b/regcomp.c
|
||||
@@ -11724,6 +11724,7 @@ S_regpiece(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth)
|
||||
if (max < min) { /* If can't match, warn and optimize to fail
|
||||
unconditionally */
|
||||
reginsert(pRExC_state, OPFAIL, orig_emit, depth+1);
|
||||
+ orig_emit->flags = 0;
|
||||
if (PASS2) {
|
||||
ckWARNreg(RExC_parse, "Quantifier {n,m} with n > m can't match");
|
||||
NEXT_OFF(orig_emit)= regarglen[OPFAIL] + NODE_STEP_REGNODE;
|
||||
@@ -19343,8 +19344,11 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o, const regmatch_
|
||||
|
||||
/* add on the verb argument if there is one */
|
||||
if ( ( k == VERB || OP(o) == ACCEPT || OP(o) == OPFAIL ) && o->flags) {
|
||||
- Perl_sv_catpvf(aTHX_ sv, ":%" SVf,
|
||||
+ if ( ARG(o) )
|
||||
+ Perl_sv_catpvf(aTHX_ sv, ":%" SVf,
|
||||
SVfARG((MUTABLE_SV(progi->data->data[ ARG( o ) ]))));
|
||||
+ else
|
||||
+ sv_catpvs(sv, ":NULL");
|
||||
}
|
||||
#else
|
||||
PERL_UNUSED_CONTEXT;
|
||||
diff --git a/t/re/pat.t b/t/re/pat.t
|
||||
index 2510eab..dda2a5a 100644
|
||||
--- a/t/re/pat.t
|
||||
+++ b/t/re/pat.t
|
||||
@@ -23,7 +23,7 @@ BEGIN {
|
||||
skip_all('no re module') unless defined &DynaLoader::boot_DynaLoader;
|
||||
skip_all_without_unicode_tables();
|
||||
|
||||
-plan tests => 838; # Update this when adding/deleting tests.
|
||||
+plan tests => 839; # Update this when adding/deleting tests.
|
||||
|
||||
run_tests() unless caller;
|
||||
|
||||
@@ -1921,6 +1921,9 @@ EOP
|
||||
pos($text) = 3;
|
||||
ok(scalar($text !~ m{(~*=[a-z]=)}g), "RT #131575");
|
||||
}
|
||||
+ {
|
||||
+ fresh_perl_is('"AA" =~ m/AA{1,0}/','',{},"handle OPFAIL insert properly");
|
||||
+ }
|
||||
|
||||
} # End of sub run_tests
|
||||
|
||||
--
|
||||
2.13.6
|
||||
|
@ -207,6 +207,10 @@ Patch60: perl-5.27.3-Term-ReadLine-generates-empty-STDERR-files.patch
|
||||
Patch61: perl-5.27.3-perl-132008-try-to-prevent-the-similar-mistakes-in-t.patch
|
||||
Patch62: perl-5.27.3-perl-132008-make-sure-the-test-behaves-without-a-tty.patch
|
||||
|
||||
# Fix a crash when a match for inversely repeated group fails, RT#132017,
|
||||
# in upstream after 5.27.3
|
||||
Patch63: perl-5.26.1-fix-132017-OPFAIL-insert-needs-to-set-flags-to-0.patch
|
||||
|
||||
# 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
|
||||
|
||||
@ -2784,6 +2788,7 @@ Perl extension for Version Objects
|
||||
%patch60 -p1
|
||||
%patch61 -p1
|
||||
%patch62 -p1
|
||||
%patch63 -p1
|
||||
%patch200 -p1
|
||||
%patch201 -p1
|
||||
|
||||
@ -2820,6 +2825,7 @@ perl -x patchlevel.h \
|
||||
'Fedora Patch58: Fix unreliable Time-HiRes tests (CPAN RT#122819)' \
|
||||
'Fedora Patch59: Fix an overflow in the lexer when reading a new line (RT#131793)' \
|
||||
'Fedora Patch60: Fix Term::ReadLine not to create spurious &STDERR files (RT#132008)' \
|
||||
'Fedora Patch63: Fix a crash when a match for inversely repeated group fails (RT#132017)' \
|
||||
'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' \
|
||||
%{nil}
|
||||
@ -5107,6 +5113,7 @@ popd
|
||||
- Remove invalid macro definitions from macros.perl (bug #1532539)
|
||||
- Fix an overflow in the lexer when reading a new line (RT#131793)
|
||||
- Fix Term::ReadLine not to create spurious &STDERR files (RT#132008)
|
||||
- Fix a crash when a match for inversely repeated group fails (RT#132017)
|
||||
|
||||
* Mon Sep 25 2017 Jitka Plesnikova <jplesnik@redhat.com> - 4:5.26.1-401
|
||||
- Update perl(:MODULE_COMPAT)
|
||||
|
Loading…
Reference in New Issue
Block a user