From: Adrian M. Enache Date: Wed, 2 Apr 2003 05:02:42 +0000 (+0300) Subject: Fix bug #21347 (segfault in UNIVERSAL::AUTOLOAD with qr//) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=39cff0d9bacec3b7c45b12560665095ba3be16b2;p=p5sagit%2Fp5-mst-13.2.git Fix bug #21347 (segfault in UNIVERSAL::AUTOLOAD with qr//) by adding a dummy destructor method Regexp::DESTROY. This prevents infinite recursion, since Regexp::DESTROY is no more autoloaded. Subject: Re: [perl #21347] segfault in UNIVERSAL::AUTOLOAD Message-ID: <20030402020242.GA2966@ratsnest.hole> p4raw-id: //depot/perl@19277 --- diff --git a/ext/B/t/stash.t b/ext/B/t/stash.t index f3fd07b..171abf1 100755 --- a/ext/B/t/stash.t +++ b/ext/B/t/stash.t @@ -66,7 +66,7 @@ print "# got = @got\n"; $got = "@got"; -my $expected = "attributes Carp Carp::Heavy DB Exporter Exporter::Heavy Internals main utf8 version warnings"; +my $expected = "attributes Carp Carp::Heavy DB Exporter Exporter::Heavy Internals main Regexp utf8 version warnings"; { no strict 'vars'; diff --git a/t/op/ref.t b/t/op/ref.t index 9470efa..ae3eef7 100755 --- a/t/op/ref.t +++ b/t/op/ref.t @@ -5,7 +5,7 @@ BEGIN { @INC = qw(. ../lib); } -print "1..65\n"; +print "1..66\n"; require 'test.pl'; @@ -340,6 +340,12 @@ if ($result eq $expect) { print "# expected \"$expect\", got \"$result\"\n"; } +# bug #21347 + +runperl(prog => 'sub UNIVERSAL::AUTOLOAD { qr// } a->p' ); +if ($? != 0) { print "not " }; +print "ok ",++$test," - UNIVERSAL::AUTOLOAD called when freeing qr//\n"; + # test global destruction ++$test; diff --git a/universal.c b/universal.c index 24621d2..e7889fb 100644 --- a/universal.c +++ b/universal.c @@ -182,6 +182,7 @@ XS(XS_Internals_SvREADONLY); XS(XS_Internals_SvREFCNT); XS(XS_Internals_hv_clear_placehold); XS(XS_PerlIO_get_layers); +XS(XS_Regexp_DESTROY); void Perl_boot_core_UNIVERSAL(pTHX) @@ -222,6 +223,7 @@ Perl_boot_core_UNIVERSAL(pTHX) XS_Internals_hv_clear_placehold, file, "\\%"); newXSproto("PerlIO::get_layers", XS_PerlIO_get_layers, file, "*;@"); + newXS("Regexp::DESTROY", XS_Regexp_DESTROY, file); } @@ -723,6 +725,11 @@ XS(XS_Internals_hv_clear_placehold) XSRETURN(0); } +XS(XS_Regexp_DESTROY) +{ + +} + XS(XS_PerlIO_get_layers) { dXSARGS;