Skip to content

Commit a774007

Browse files
author
Fabrice Bellard
committed
removed buffer overflows introduced in regexp optimizations
1 parent 728ed94 commit a774007

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

libregexp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2737,7 +2737,7 @@ static intptr_t lre_exec_backtrack(REExecContext *s, uint8_t **capture,
27372737
if (idx2 >= 0)
27382738
capture[idx2] = sp[-1].ptr;
27392739
else
2740-
aux_stack[-idx2 + 1] = sp[-1].ptr;
2740+
aux_stack[-idx2 - 1] = sp[-1].ptr;
27412741
sp -= 2;
27422742
}
27432743

@@ -2794,7 +2794,7 @@ static intptr_t lre_exec_backtrack(REExecContext *s, uint8_t **capture,
27942794
if (idx2 >= 0)
27952795
capture[idx2] = sp[-1].ptr;
27962796
else
2797-
aux_stack[-idx2 + 1] = sp[-1].ptr;
2797+
aux_stack[-idx2 - 1] = sp[-1].ptr;
27982798
sp -= 2;
27992799
}
28002800
pc = sp[-3].ptr;

quickjs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18022,7 +18022,7 @@ static JSValue JS_CallInternal(JSContext *caller_ctx, JSValueConst func_obj,
1802218022
{
1802318023
sp[-2] = JS_NewRegexp(ctx, sp[-2], sp[-1]);
1802418024
sp--;
18025-
if (JS_IsException(sp[-2]))
18025+
if (JS_IsException(sp[-1]))
1802618026
goto exception;
1802718027
}
1802818028
BREAK;

0 commit comments

Comments
 (0)