Change 31313 by [EMAIL PROTECTED] on 2007/05/31 08:25:57

        blead segfaults on local *@; eval {1} because ERRSV assumes that
        GvSV(PL_errgv) is always non-NULL. That stopped being the case with
        change 25009 (ish) - when we stopped automatically creating a(n unused)
        SV at GV creation time.

Affected files ...

... //depot/perl/scope.c#210 edit
... //depot/perl/t/op/local.t#36 edit

Differences ...

==== //depot/perl/scope.c#210 (text) ====
Index: perl/scope.c
--- perl/scope.c#209~31301~     2007-05-29 01:41:09.000000000 -0700
+++ perl/scope.c        2007-05-31 01:25:57.000000000 -0700
@@ -261,6 +261,14 @@
            gp->gp_io = newIO();
            IoFLAGS(gp->gp_io) |= IOf_ARGV|IOf_START;
        }
+#ifdef PERL_DONT_CREATE_GVSV
+       if (gv == PL_errgv) {
+           /* We could scatter this logic everywhere by changing the
+              definition of ERRSV from GvSV() to GvSVn(), but it seems more
+              efficient to do this check once here.  */
+           gp->gp_sv = newSV(0);
+       }
+#endif
        GvGP(gv) = gp;
     }
     else {

==== //depot/perl/t/op/local.t#36 (xtext) ====
Index: perl/t/op/local.t
--- perl/t/op/local.t#35~31311~ 2007-05-30 06:59:17.000000000 -0700
+++ perl/t/op/local.t   2007-05-31 01:25:57.000000000 -0700
@@ -5,7 +5,7 @@
     @INC = qw(. ../lib);
     require './test.pl';
 }
-plan tests => 120;
+plan tests => 122;
 
 my $list_assignment_supported = 1;
 
@@ -453,3 +453,12 @@
     ok(! exists($h{'k2'}));
     is($h{'k1'},111);
 }
+
+# Keep this test last, as it can SEGV
+{
+    local *@;
+    pass("Localised *@");
+    eval {1};
+    pass("Can eval with *@ localised");
+}
+
End of Patch.

Reply via email to