This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
add stack extend to Perl_die_unwind()
authorDavid Mitchell <davem@iabyn.com>
Fri, 27 Jan 2023 20:12:54 +0000 (20:12 +0000)
committerDavid Mitchell <davem@iabyn.com>
Wed, 16 Aug 2023 16:17:00 +0000 (17:17 +0100)
commit1af84bbbb8a5031d40ed8bbe1b9de45d800ba849
treef3e11a94eec4bfcdf6722bb99dab65aef6a34483
parentba1af285ef4f9b4a71183b7b4a1ffed410d1a7f5
add stack extend to Perl_die_unwind()

When invoked via a scalar-context eval, die_unwind() was pushing
&PL_sv_undef without extending the stack first. It's been this way for
many years. Spotted by visual inspection while adding rpp_() code.

I could get a SEGV with the following code, but I haven't added it as a
test as it's highly sensitive to exactly what size stack is initially
allocated and the OS's malloc().

    my $x;
    my @a =
        ($x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,
         $x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,
         $x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,
         $x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,
         $x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,
         $x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,
         $x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,
         $x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,$x,
         scalar eval { die },
    );
pp_ctl.c