Fix the bug introduced by the bug fix of change 30755.
authorNicholas Clark <nick@ccl4.org>
Wed, 9 Jan 2008 23:26:14 +0000 (23:26 +0000)
committerNicholas Clark <nick@ccl4.org>
Wed, 9 Jan 2008 23:26:14 +0000 (23:26 +0000)
(Certain regexps could SEGV if cloned).

p4raw-id: //depot/perl@32932

regcomp.c
t/op/pat.t

index fa8e0f1..03d1112 100644 (file)
--- 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;
+           }
        }
     }
 
index 2ccc07c..b6e8b68 100755 (executable)
@@ -1297,10 +1297,7 @@ print "ok 246\n";
 print "not " unless "\x{abcd}" =~ /\x{abcd}/;
 print "ok 247\n";
 
-if ($::running_as_thread) {
-    print "not ok 248 # TODO & SKIP: SEGVs in 5.10 when threaded\n";
-    print "not ok 249 # TODO & SKIP: SEGVs in 5.10 when threaded\n";
-} else {
+{
     # bug id 20001008.001
 
     $test = 248;