summaryrefslogtreecommitdiff
path: root/regcomp.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2008-01-09 23:26:14 +0000
committerNicholas Clark <nick@ccl4.org>2008-01-09 23:26:14 +0000
commit66b1de870892b142348d95c3a6c21c7ff7269508 (patch)
treec1626f30a9a8878212490da14ee0ae282b45e172 /regcomp.c
parente3faa678eb30e1e08116ca1bd086624974e5e5aa (diff)
downloadperl-66b1de870892b142348d95c3a6c21c7ff7269508.tar.gz
Fix the bug introduced by the bug fix of change 30755.
(Certain regexps could SEGV if cloned). p4raw-id: //depot/perl@32932
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/regcomp.c b/regcomp.c
index fa8e0f162b..03d11126e1 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -9409,7 +9409,9 @@ Perl_re_dup_guts(pTHX_ const REGEXP *sstr, REGEXP *dstr, CLONE_PARAMS *param)
/* Do it this way to avoid reading from *r after the StructCopy().
That way, if any of the sv_dup_inc()s dislodge *r from the L1
cache, it doesn't matter. */
- const bool anchored = r->check_substr == r->anchored_substr;
+ const bool anchored = r->check_substr
+ ? r->check_substr == r->anchored_substr
+ : r->check_utf8 == r->anchored_utf8;
Newx(ret->substrs, 1, struct reg_substr_data);
StructCopy(r->substrs, ret->substrs, struct reg_substr_data);
@@ -9432,6 +9434,12 @@ Perl_re_dup_guts(pTHX_ const REGEXP *sstr, REGEXP *dstr, CLONE_PARAMS *param)
ret->check_substr = ret->float_substr;
ret->check_utf8 = ret->float_utf8;
}
+ } else if (ret->check_utf8) {
+ if (anchored) {
+ ret->check_utf8 = ret->anchored_utf8;
+ } else {
+ ret->check_utf8 = ret->float_utf8;
+ }
}
}