summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-12-10 22:31:56 +0000
committerNicholas Clark <nick@ccl4.org>2006-12-10 22:31:56 +0000
commit0b3e77ec2e46a23afe97475f6b9bf7880fae85f1 (patch)
treefbd2cac1d5430d518eca1056f17cbc57a6ab25b0 /regexec.c
parent2af555bf3f2b3ca8e114df3f5f680d40bd24d6bf (diff)
downloadperl-0b3e77ec2e46a23afe97475f6b9bf7880fae85f1.tar.gz
Downgrading a fixed or floating substring of a pattern whilst matching
a studied string seems to get to a "should not happen" [bug #41067] It seems that Perl_regexec_flags() assumes that if the pre-downgraded substring is FBM compiled, then the downgraded version will be too, hence changing the downgrade and upgrade routines to FBM compile seems to be a correct fix. p4raw-id: //depot/perl@29502
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/regexec.c b/regexec.c
index 2da8bfd676..7cd7d5f738 100644
--- a/regexec.c
+++ b/regexec.c
@@ -5621,6 +5621,8 @@ S_to_utf8_substr(pTHX_ register regexp *prog)
SV* const sv = newSVsv(prog->float_substr);
prog->float_utf8 = sv;
sv_utf8_upgrade(sv);
+ if (SvVALID(prog->float_substr))
+ fbm_compile(sv, 0);
if (SvTAIL(prog->float_substr))
SvTAIL_on(sv);
if (prog->float_substr == prog->check_substr)
@@ -5630,6 +5632,8 @@ S_to_utf8_substr(pTHX_ register regexp *prog)
SV* const sv = newSVsv(prog->anchored_substr);
prog->anchored_utf8 = sv;
sv_utf8_upgrade(sv);
+ if (SvVALID(prog->anchored_substr))
+ fbm_compile(sv, 0);
if (SvTAIL(prog->anchored_substr))
SvTAIL_on(sv);
if (prog->anchored_substr == prog->check_substr)
@@ -5645,6 +5649,8 @@ S_to_byte_substr(pTHX_ register regexp *prog)
SV* sv = newSVsv(prog->float_utf8);
prog->float_substr = sv;
if (sv_utf8_downgrade(sv, TRUE)) {
+ if (SvVALID(prog->float_utf8))
+ fbm_compile(sv, 0);
if (SvTAIL(prog->float_utf8))
SvTAIL_on(sv);
} else {
@@ -5658,6 +5664,8 @@ S_to_byte_substr(pTHX_ register regexp *prog)
SV* sv = newSVsv(prog->anchored_utf8);
prog->anchored_substr = sv;
if (sv_utf8_downgrade(sv, TRUE)) {
+ if (SvVALID(prog->anchored_utf8))
+ fbm_compile(sv, 0);
if (SvTAIL(prog->anchored_utf8))
SvTAIL_on(sv);
} else {