List Info

Thread: Re: Blead segfaults on local *@; eval




Re: Blead segfaults on local *@; eval
user name
2007-05-31 03:27:02
On Wed, May 30, 2007 at 06:34:28PM +0000, var Arnfjr
Bjarmason wrote:
> Changing:
> 
> #define ERRSV GvSV(PL_errgv)
> 
> to:
> 
> #define ERRSV GvSVn(PL_errgv)
> 
> Would work around this, whether it's a proper fix I
don't know.

Yes, I think that it would actually be a correct fix. But I
think that the
appended fix would be more efficient.

Nicholas Clark

Change 31313 by nicholasnicholas-saigo on
2007/05/31 08:25:57

	blead segfaults on local *; eval  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) ====

 -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) ====

 -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 ;
+    pass("Can eval with * localised");
+}
+

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )