This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #124097] don't let the GPs be removed out from under pp_sort
authorTony Cook <tony@develop-help.com>
Thu, 17 Dec 2015 04:14:58 +0000 (15:14 +1100)
committerTony Cook <tony@develop-help.com>
Thu, 17 Dec 2015 04:14:58 +0000 (15:14 +1100)
commitdc9ef9989ca4dc4207da49f653e8789816f50a11
tree32e8142288dc631bca78af658bf53102d88ab256
parent68bcb860c817a4691f45504f9563923c5ab2f6da
[perl #124097] don't let the GPs be removed out from under pp_sort

pp_sort() saves the SV pointers for *a and *b, if the sort block
cleared *a or *b the GP, which the pointer is stored would be freed
and the save stack processing would try to write to freed memory.

Make sure the GP lasts at least long enough for the SV slots to be
restored.  This doesn't attempt to restore *a or *b, the user chose
to clear them.
pp_sort.c
t/op/sort.t