This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
ss_dup: make new savestack have SS_MAXPUSH extra
This fixes RT #perl #127799
My commit v5.23.7-261-g3caf026 made PL_savestack_max claim to have
allocated less than had actually been claimed (by a margin of SS_MAXPUSH).
This made the 'check whether the stack needs extending code' slightly
simpler, and errs on the side of safety. Except:
Perl_ss_dup(), when duplicating the savestack, makes the new stack
PL_savestack_max in size, which is large enough to duplicate the existing
stack, but the new stack no longer has a SS_MAXPUSH margin at the top.
The dSS_ADD family of macros work by assuming there is always such a
margin: they push their args onto the stack and only then check whether
the stack needs growing. This makes the code much more efficient, but of
course breaks if no margin is present.