Subject: | subname() segfaults on deleted stash |
$ perl -MSub::Util=subname -e '{ package Foo; sub bar {} } my $sub = \&Foo::Bar; delete $::{"Foo::"}; subname($sub)'
Segmentation fault
Full backtrace from Sub::Util 1.45 on debugging perl 5.24.0:
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff626c3b5 in XS_Sub__Util_subname (cv=<optimized out>) at ListUtil.xs:1513
1513 ListUtil.xs: No such file or directory.
(gdb) bt full
#0 0x00007ffff626c3b5 in XS_Sub__Util_subname (cv=<optimized out>) at ListUtil.xs:1513
code = 0x624320
cv = <optimized out>
sp = 0x606b58
ax = <optimized out>
__PRETTY_FUNCTION__ = "XS_Sub__Util_subname"
mark = <optimized out>
items = <optimized out>
#1 0x00007ffff79cb19d in Perl_pp_entersub () at pp_hot.c:3987
markix = <optimized out>
is_scalar = false
sp = <optimized out>
sv = 0x65c998
gv = 0x0
cv = <optimized out>
cx = 0x629d00
old_savestack_ix = <optimized out>
__PRETTY_FUNCTION__ = "Perl_pp_entersub"
#2 0x00007ffff7991b47 in Perl_runops_debug () at dump.c:2239
No locals.
#3 0x00007ffff7904e02 in S_run_body (oldscope=1) at perl.c:2483
No locals.
#4 perl_run (my_perl=<optimized out>) at perl.c:2406
oldscope = 1
ret = <optimized out>
cur_env = {je_prev = 0x7ffff7ddb0c0 <PL_start_env>, je_buf = {{__jmpbuf = {0, 807392774450212573, 4197802,
140737488344944, 0, 0, -807392773155950883, -807410610812588323}, __mask_was_saved = 0,
__saved_mask = {__val = {0, 0, 0, 140737351949767, 140733193388033, 0, 4197802, 140737346407192, 0, 0,
4197802, 140737351975653, 0, 0, 140737351889088, 0}}}}, je_ret = 0, je_mustcatch = false,
je_old_delaymagic = 0}
__PRETTY_FUNCTION__ = "perl_run"
#5 0x0000000000400d9b in main (argc=4, argv=0x7fffffffd778, env=0x7fffffffd7a0) at perlmain.c:116
exitstatus = <optimized out>
i = <optimized out>