From 70ecb4be2ac4243cbdb6586f87a091a7f8055d91 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Thu, 7 Mar 2019 11:37:21 -0700 Subject: [PATCH] PATCH: [perl #133899] panic in s/// Thanks for finding this bug, and the others you've been finding. A new regnode was added, but this function was not updated to account for that. I've now checked all the other new regnodes in 5.29 and this was the only missing one. --- regexec.c | 3 +++ t/re/subst.t | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/regexec.c b/regexec.c index bb3a630e871a..7cc339a17b51 100644 --- a/regexec.c +++ b/regexec.c @@ -4548,6 +4548,9 @@ S_setup_EXACTISH_ST_c1_c2(pTHX_ const regnode * const text_node, int *c1p, case EXACTFU: c2 = PL_fold_latin1[c1]; break; + case EXACTFU_ONLY8: + return FALSE; + NOT_REACHED; /* NOTREACHED */ default: Perl_croak(aTHX_ "panic: Unexpected op %u", OP(text_node)); diff --git a/t/re/subst.t b/t/re/subst.t index dd62e95ee64f..32076921f50d 100644 --- a/t/re/subst.t +++ b/t/re/subst.t @@ -11,7 +11,7 @@ BEGIN { require './loc_tools.pl'; } -plan(tests => 276); +plan(tests => 277); $_ = 'david'; $a = s/david/rules/r; @@ -1174,5 +1174,8 @@ __EOF__ is $lines, 4, "RT #131930"; } +{ # [perl $133899], would panic - + fresh_perl_is('my $a = "ha"; $a =~ s!|0?h\x{300}(?{})!!gi', "", {}, + "[perl #133899] s!|0?h\\x{300}(?{})!!gi panics"); +}