Make PL_DBgv and other db interp vars refcounted
authorFather Chrysostomos <sprout@cpan.org>
Sat, 26 Oct 2013 13:00:59 +0000 (06:00 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sat, 26 Oct 2013 13:00:59 +0000 (06:00 -0700)
commit8cece9139aefc96dd3920fa7908afea1581f51b7
tree77e6ff3562783ced6268592a9717a584e2f496fb
parentb188953e9dd3c8a2696f2e1ea1f59ccc6a80d81f
Make PL_DBgv and other db interp vars refcounted

$ PERL5DB=1 perl -de '*DB::DB = sub {} if 0; sub DB::DB{}'
No DB::DB routine defined at -e line 1.

When the ‘if’ gets folded and *DB::DB is freed, it triggers
gv_try_downgrade, causing $DB::{DB} to be deleted and PL_DBgv to point
to a freed SV.  A higher refcount would prevent gv_try_downgrade from
touching it.
perl.c
sv.c
t/run/switchd.t