If a function is given a typeglob alias by assigning a reference of that function to the typeglob, then the original symbol is undefined, Perl will segfault inside of Devel::QuickCover as a result of a null pointer when the function is invoked as its alias. Specifically, consider the following program:
# cat bad.pl
sub a { 0; }
sub b { 1; }
*a = \&b;
my ( $a_ref, $b_ref ) = ( \&a, \&b );
print "$a_ref, $b_ref\n";
undef *b if $ARGV[1];
$a_ref = \&a;
print "$a_ref\n";
my $i = a();
print "$i\n”;
The expected result of the program under all cases is that $i will be assigned the value 1. However, if Devel::QuickCover is included when an argument is passed (which causes the original &b to become undefined), Perl will segfault:
I have reproduced this with a custom build of Perl 5.28.0 and Devel::QuickCover 0.900010 on CentOS 7.6, as well as the system build of Perl 5.22.2 and CPAN build of Devel::QuickCover 0.900014 on Slackware 14.2.
(Reposted from https://rt.cpan.org/Public/Bug/Display.html?id=130307)
If a function is given a typeglob alias by assigning a reference of that function to the typeglob, then the original symbol is undefined, Perl will segfault inside of Devel::QuickCover as a result of a null pointer when the function is invoked as its alias. Specifically, consider the following program:
The expected result of the program under all cases is that
$i
will be assigned the value1
. However, if Devel::QuickCover is included when an argument is passed (which causes the original&b
to become undefined), Perl will segfault:The immediate cause of the segfault is that the
file
variable isNULL
whenadd_covered_sub_helper()
in quickcover.xs is called:I have reproduced this with a custom build of Perl 5.28.0 and Devel::QuickCover 0.900010 on CentOS 7.6, as well as the system build of Perl 5.22.2 and CPAN build of Devel::QuickCover 0.900014 on Slackware 14.2.