summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2023-02-20 04:43:14 +0100
committerYves Orton <demerphq@gmail.com>2023-02-20 16:17:07 +0800
commitbbf836262130e1ab1030c03e3b3b390c28c4bbda (patch)
tree3c467a5a8c53c87fc1ee3e4e03a0bbcbdcee60e4 /regexec.c
parent0a73ee9e231197058947bf0a854703757dc357ac (diff)
downloadperl-bbf836262130e1ab1030c03e3b3b390c28c4bbda.tar.gz
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.
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/regexec.c b/regexec.c
index c37193d004..3d9caa5104 100644
--- a/regexec.c
+++ b/regexec.c
@@ -263,6 +263,7 @@ S_regcppush(pTHX_ const regexp *rex, I32 parenfloor, U32 maxopenparen _pDEPTH)
);
SSCHECK(total_elems + REGCP_FRAME_ELEMS);
+ assert((IV)PL_savestack_max > (IV)(total_elems + REGCP_FRAME_ELEMS));
/* memcpy the offs inside the stack - it's faster than for loop */
memcpy(&PL_savestack[PL_savestack_ix], rex->offs + parenfloor + 1, paren_bytes_to_push);