diff options
author | Niko Tyni <ntyni@debian.org> | 2010-01-19 11:03:08 +0100 |
---|---|---|
committer | Steffen Mueller <smueller@cpan.org> | 2010-01-19 11:04:29 +0100 |
commit | 1f15e670edb515b744e9021b4a42a7955da83093 (patch) | |
tree | 748d606ce4c3db5cebc6f0be851b6b33e6044ee6 /t | |
parent | 1f730e6c11736bad913e605b064200a67117e898 (diff) | |
download | perl-1f15e670edb515b744e9021b4a42a7955da83093.tar.gz |
Fix a NULL pointer dereference when looking for a DESTROY method
The empty DESTROY method optimization introduced by commit
fbb3ee5af3d would crash the interpreter if a DESTROY method
was declared but not actually defined.
This is seen in the real world with AutoLoader / AutoSplit,
where the crash defeats autoloading a DESTROY method.
Diffstat (limited to 't')
-rw-r--r-- | t/op/method.t | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/t/op/method.t b/t/op/method.t index afa8cfbb2a..b602ca220b 100644 --- a/t/op/method.t +++ b/t/op/method.t @@ -10,7 +10,7 @@ BEGIN { require "test.pl"; } -print "1..78\n"; +print "1..79\n"; @A::ISA = 'B'; @B::ISA = 'C'; @@ -292,3 +292,16 @@ EOT "check if UNIVERSAL::AUTOLOAD works", ); } + +# Test for #71952: crash when looking for a nonexistent destructor +# Regression introduced by fbb3ee5af3d4 +{ + fresh_perl_is(<<'EOT', +sub M::DESTROY; bless {}, "M" ; print "survived\n"; +EOT + "survived", + {}, + "no crash with a declared but missing DESTROY method" + ); +} + |