Change 33176 by [EMAIL PROTECTED] on 2008/02/01 21:03:39

        Integrate:
        [ 32229]
        Add a TODO test for bug #47195
        
        [ 32236]
        Subject: [PATCH blead] Re: [perl #47195] $1 suddenly tainted after 
regexp on utf-8 string
        From: Rick Delaney <[EMAIL PROTECTED]>
        Message-ID: <[EMAIL PROTECTED]>
        Date: Tue, 6 Nov 2007 19:18:45 -0500
        
        [plus remove the TODO from the now passing test]
        
        [ 32533]
        Fix bless/readonly failure spotted by Jerry Hedden.

Affected files ...

... //depot/maint-5.8/perl/regexec.c#99 integrate
... //depot/maint-5.8/perl/sv.c#373 integrate
... //depot/maint-5.8/perl/t/op/bless.t#4 integrate
... //depot/maint-5.8/perl/t/op/taint.t#26 integrate

Differences ...

==== //depot/maint-5.8/perl/regexec.c#99 (text) ====
Index: perl/regexec.c
--- perl/regexec.c#98~33175~    2008-02-01 12:32:00.000000000 -0800
+++ perl/regexec.c      2008-02-01 13:03:39.000000000 -0800
@@ -3947,8 +3947,8 @@
        } else {
            while (scan < loceol && !isSPACE(*scan))
                scan++;
-           break;
        }
+       break;
     case NSPACEL:
        PL_reg_flags |= RF_tainted;
        if (do_utf8) {

==== //depot/maint-5.8/perl/sv.c#373 (text) ====
Index: perl/sv.c
--- perl/sv.c#372~32545~        2007-11-28 15:35:51.000000000 -0800
+++ perl/sv.c   2008-02-01 13:03:39.000000000 -0800
@@ -7572,6 +7572,8 @@
         Perl_croak(aTHX_ "Can't bless non-reference value");
     tmpRef = SvRV(sv);
     if (SvFLAGS(tmpRef) & (SVs_OBJECT|SVf_READONLY)) {
+       if (SvIsCOW(tmpRef))
+           sv_force_normal_flags(tmpRef, 0);
        if (SvREADONLY(tmpRef))
            Perl_croak(aTHX_ PL_no_modify);
        if (SvOBJECT(tmpRef)) {

==== //depot/maint-5.8/perl/t/op/bless.t#4 (text) ====
Index: perl/t/op/bless.t
--- perl/t/op/bless.t#3~30522~  2007-03-09 09:20:49.000000000 -0800
+++ perl/t/op/bless.t   2008-02-01 13:03:39.000000000 -0800
@@ -6,7 +6,7 @@
     require './test.pl';
 }
 
-plan (106);
+plan (108);
 
 sub expected {
     my($object, $package, $type) = @_;
@@ -128,3 +128,14 @@
 $c4 = eval { bless \$test, $h1 };
 is ($@, '', "class is an overloaded ref");
 expected($c4, 'C4', "SCALAR");
+
+{
+    my %h = 1..2;
+    my($k) = keys %h; 
+    my $x=\$k;
+    bless $x, 'pam';
+    is(ref $x, 'pam');
+
+    my $a = bless \(keys %h), 'zap';
+    is(ref $a, 'zap');
+}

==== //depot/maint-5.8/perl/t/op/taint.t#26 (xtext) ====
Index: perl/t/op/taint.t
--- perl/t/op/taint.t#25~32991~ 2008-01-17 09:17:05.000000000 -0800
+++ perl/t/op/taint.t   2008-02-01 13:03:39.000000000 -0800
@@ -17,7 +17,7 @@
 use File::Spec::Functions;
 
 BEGIN { require './test.pl'; }
-plan tests => 257;
+plan tests => 263;
 
 $| = 1;
 
@@ -1234,6 +1234,15 @@
     is ($val, '7000000000', 'Assignment to tainted variable');
 }
 
+foreach my $ord (78, 163, 256) {
+    # 47195
+    my $line = 'A1' . $TAINT . chr $ord;
+    chop $line;
+    is($line, 'A1');
+    $line =~ /(A\S*)/;
+    ok(!tainted($1), "\\S match with chr $ord");
+}
+
 # This may bomb out with the alarm signal so keep it last
 SKIP: {
     skip "No alarm()"  unless $Config{d_alarm};
End of Patch.

Reply via email to