This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Stop &xsub and goto &xsub from crashing on undef *_
authorFather Chrysostomos <sprout@cpan.org>
Fri, 6 Sep 2013 15:30:41 +0000 (08:30 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sat, 7 Sep 2013 06:25:49 +0000 (23:25 -0700)
commit8c9d3376fbfa04ec0e0e2164dcf7d9e824cf0e94
treed7a979047d5b68fbfe6d7997270062787f830de6
parent425b8234618a94b12ca70c9914e5818c3952c7ed
Stop &xsub and goto &xsub from crashing on undef *_

$ perl -e 'undef *_; &Internals::V'
Segmentation fault: 11
$ perl -e 'sub { undef *_; goto &Internals::V }->()'
$ perl5.18.1 -e 'sub { undef *_; goto &Internals::V }->()'
Segmentation fault: 11

The goto case is actually a regression from 5.16 (049bd5ffd62), as
goto used to ignore changes to *_.  (Fixing one bug uncovers another.)

We shouldn’t assume that GvAV(PL_defgv) (*_{ARRAY}) gives us anything.

While we’re at it, since we have to add extra checks anyway, use them
to speed up empty @_ in goto (by checking items, rather than arg).
pp_ctl.c
pp_hot.c
t/op/goto.t
t/op/sub.t