summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2024-04-12 15:01:47 +1000
committerNARUSE, Yui <naruse@airemix.jp>2024-04-22 16:29:28 +0900
commitc38fc1bb36597264840d96d7475b9891c61c5240 (patch)
tree54e6153ae2151127ccb6a3fb5225abfc0c7d4039
parent7227b859a7bf7626ee73de8130796657b7c7f3b5 (diff)
Fix Use-After-Free issue for Regexp
Co-authored-by: Isaac Peka <7493006+isaac-peka@users.noreply.github.com>
-rw-r--r--regexec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/regexec.c b/regexec.c
index ed1598c497..9e027d8f4e 100644
--- a/regexec.c
+++ b/regexec.c
@@ -3435,8 +3435,8 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
CASE(OP_MEMORY_END_PUSH_REC) MOP_IN(OP_MEMORY_END_PUSH_REC);
GET_MEMNUM_INC(mem, p);
STACK_GET_MEM_START(mem, stkp); /* should be before push mem-end. */
- STACK_PUSH_MEM_END(mem, s);
mem_start_stk[mem] = GET_STACK_INDEX(stkp);
+ STACK_PUSH_MEM_END(mem, s);
MOP_OUT;
JUMP;