develooper Front page | perl.perl5.porters | Postings from March 2003

Re: [perl #21347] segfault in UNIVERSAL::AUTOLOAD

Thread Previous | Thread Next
From:
Enache Adrian
Date:
March 8, 2003 05:09
Subject:
Re: [perl #21347] segfault in UNIVERSAL::AUTOLOAD
Message ID:
20030308131208.GA3537@ratsnest.hole
On Sat, Mar 08, 2003 at 01:39:06PM +0200, Enache Adrian wrote:
> $ perl -e 'sub UNIVERSAL::DESTROY { warn } ; $b=1; $a=\$b; bless $a, ITCH'
> Warning: something's wrong at -e line 1 during global destruction.
> Warning: something's wrong at -e line 1 during global destruction.
> Segmentation fault
> 
> (three warnings in 5.8.0, one single in 5.6.1, and SEGV in all)

This seems to guard against it:
------------------------------------------------------------------
--- /arc/perl-current/util.c	2003-03-03 08:45:50.000000000 +0200
+++ util.c	2003-03-08 14:54:12.000000000 +0200
@@ -1242,7 +1242,7 @@ Perl_vwarn(pTHX_ const char* pat, va_lis
     }
 
     /* if STDERR is tied, use it instead */
-    if (PL_stderrgv && (io = GvIOp(PL_stderrgv))
+    if (PL_stderrgv && SvREFCNT(PL_stderrgv) && (io = GvIOp(PL_stderrgv))
 	&& (mg = SvTIED_mg((SV*)io, PERL_MAGIC_tiedscalar))) {
 	dSP; ENTER;
 	PUSHMARK(SP);
------------------------------------------------------------------

Regards
Adi

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About