diff options
author | David Mitchell <davem@iabyn.com> | 2023-01-04 17:33:24 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2023-01-04 17:33:24 +0000 |
commit | 25a36e71fc493a6139ad72fbee25617b129969f1 (patch) | |
tree | d882eef2dcf0b78b95e6cc61cbdab3d836a470f9 /util.c | |
parent | 8029d5fd58db3ede38ab8ad15c91d6796b2a86bf (diff) | |
download | perl-25a36e71fc493a6139ad72fbee25617b129969f1.tar.gz |
Storable: add missing PUTBACK in store_code()
store_code() does a POPs, but not a PUTBACK, before returning, so
PL_stack_sp was one too high on return. For example in the following
code:
use Storable qw(freeze);
my $obj = [
sub { 1; },
sub { 2; },
sub { 4; },
sub { 4; },
];
$Storable::Deparse = 1;
while (1) {
my $freezed = freeze $obj;
}
On the first four calls to store_code() - to deparse each of the anon
subs - PL_stack_sp is one higher than the previous call.
On subsequent calls to freeze(), PL_stack_sp is reset to its original
value.
I don't know whether this bug has any visible effects; I spotted it during
my work to make the stack reference-counted; PL_stack_sp not being
decremented caused the SV at that location to be double-counted.
Diffstat (limited to 'util.c')
0 files changed, 0 insertions, 0 deletions