mirror of
https://github.com/Perl/perl5.git
synced 2026-01-26 16:39:36 +00:00
av_extend_guts: set correct ary_offset when unshifting an array (GH#18667)
This commit is contained in:
parent
d23c9e49d1
commit
ce9f3c9c00
1
av.c
1
av.c
@ -110,6 +110,7 @@ Perl_av_extend_guts(pTHX_ AV *av, SSize_t key, SSize_t *maxp, SV ***allocp,
|
||||
if (av && *allocp != *arrayp) { /* a shifted SV* array exists */
|
||||
to_null = *arrayp - *allocp;
|
||||
*maxp += to_null;
|
||||
ary_offset = AvFILLp(av) + 1;
|
||||
|
||||
Move(*arrayp, *allocp, AvFILLp(av)+1, SV*);
|
||||
|
||||
|
||||
@ -108,4 +108,10 @@ is sprintf("%s", splice @a, 0, 1, undef), "",
|
||||
"croak when splicing into readonly array";
|
||||
}
|
||||
|
||||
# GH#18667 - av_extend_guts must zero duplicate SV*s
|
||||
fresh_perl_is('my @data = (undef) x 4; splice @data, 1, 1;
|
||||
splice @data, 2, 1; $data[3] = undef; splice @data, 3, 1;',
|
||||
'', {}, 'GH#18667 - av_extend_guts must zero duplicate SV*s');
|
||||
|
||||
|
||||
done_testing;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user