Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 9e298ab597b2c6fc0741749d7e29119e2d6cd628
      
https://github.com/Perl/perl5/commit/9e298ab597b2c6fc0741749d7e29119e2d6cd628
  Author: Richard Leach <richardle...@users.noreply.github.com>
  Date:   2023-07-20 (Thu, 20 Jul 2023)

  Changed paths:
    M av.c
    M t/op/array.t

  Log Message:
  -----------
  Perl_av_extend_guts: Zero() trailing elements after unshift & resize

Since 
https://github.com/Perl/perl5/commit/399fef93c903aedee05a74de780b57eeeb571b32,
trailing elements in an array that has been unshifted and resized
might not be properly Zero() initialized. This is because of faulty
arithmetic when calculating `to_null`, the number of elements to
initialize, when the array was only partially shifted.

This commit corrects the arithmetic, adds comments arount the
calculation of `to_null`, and adds a test based upon the case
provided in GH #21235.

The test added segfaults more reliably for me - almost every time -
than the originally supplied case. However, since it relies upon
uninitialized memory, it's probably still not deterministic and
somewhat dependent upon the choice of memory allocator.

Closes #21235


Reply via email to