Branch: refs/heads/yves/unify_SSCHECK_and_SSGROW Home: https://github.com/Perl/perl5 Commit: 4783598e04d4f72ba9276e3c1da3c95204067761 https://github.com/Perl/perl5/commit/4783598e04d4f72ba9276e3c1da3c95204067761 Author: Yves Orton <demer...@gmail.com> Date: 2023-02-20 (Mon, 20 Feb 2023)
Changed paths: M regexec.c M t/re/pat.t Log Message: ----------- regexec.c - add assert and test for savestack overflow in Issue #20826. We have a bug where we can overflow the save-stack. This tests for it in a TODO test. The next patch will fix it. Note the test will only fail in debugging as it requires the assert() to be compiled in. Commit: 217acabb77ca480157ce0eb7fd8d848883a5a40a https://github.com/Perl/perl5/commit/217acabb77ca480157ce0eb7fd8d848883a5a40a Author: Yves Orton <demer...@gmail.com> Date: 2023-02-20 (Mon, 20 Feb 2023) Changed paths: M regexec.c M scope.c M scope.h M t/re/pat.t Log Message: ----------- scope.c - rework SSGROW() and SSCHECK() macros and undelying functions Prior to this patch SSCHECK() took a "needs" parameter, but did not actually guarantee that the stack would be sufficiently large to accomodate that many elements after the call. This was quite misleading. Especially as SSGROW() would not do geometric preallocation, but SSCHECK() would, so much of the time SSCHECK() would appear to be a better choice, but not always. This patch makes it so SSCHECK() is an alias for SSGROW(), and it makes it so that SSGROW() also geometrically overallocates. The underlying function that used to implement SSCHECK() savestack_grow() now calls the savestack_grow_cnt() which has always implemented SSGROW(). Anything in the internals that used to call SSCHECK() now calls SSGROW() instead. At the same time the preallocation has been made a little bit more aggressive, ensuring that we always allocate at least SS_MAXPUSH elements on top of what was requested as part of the "known" size of the stack, and additional SS_MAXPUSH elements which are not part of the "known" size of the stack. This "hidden extra" is used to simply some of the other macros which are used a lot internally. (I have beefed up the comment explaining this as well.) This fixes GH Issue #20826 Compare: https://github.com/Perl/perl5/compare/81d9b321946a...217acabb77ca