Stop aelemfast from crashing on GVs with null AVs
authorFather Chrysostomos <sprout@cpan.org>
Sat, 26 Feb 2011 06:31:02 +0000 (22:31 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Sat, 26 Feb 2011 14:35:16 +0000 (06:35 -0800)
commit8f878375c44ca8966a9b6ee166fd9d10f631a68b
treeb6c279afb250d6449455bf52629a9c34bb376790
parent08973043bcacf380545b7ccd9b9d87c39b56b75e
Stop aelemfast from crashing on GVs with null AVs

As reported at nntp://nntp.perl.org/1298599236.4753.72.camel@p100 (and
respaced for readability):

#!perl5.12.0
$r=q/
      print __FILE__;
      local *dbline = $main::{"_<".__FILE__};
      print $dbline[0]
/;
eval $r;'
__END__
(eval 1)
Bus error

This only seems to happen in non-threaded perls.

It can be reduced to this:

*d = *a;  print $d[0];

The $d[0] is optimised into an aelemfast op (instead of the usual aelem
with an rv2av kid). pp_aelemfast is at fault, as evidenced by the fact
that this does not crash (the ${\...} prevents the optimisation):

*d = *a;  print $d[${\0}];

pp_aelemfast uses GvAV instead of GvAVn. Usually $d[0] will autovivify
@d, but the glob assignment leaves $d[0] pointing to a glob (*d) with
no array. Then pp_alemfast passes a null pointer around.
pp_hot.c
t/op/array.t