Module: wine Branch: master Commit: c0e8f1669fb74591a873cd49572b6afba080d04d URL: https://gitlab.winehq.org/wine/wine/-/commit/c0e8f1669fb74591a873cd49572b6af...
Author: Gabriel Ivăncescu gabrielopcode@gmail.com Date: Mon May 29 21:58:37 2023 +0300
jscript: Throw proper error for out of memory conditions in RegExp.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com
---
dlls/jscript/regexp.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/dlls/jscript/regexp.c b/dlls/jscript/regexp.c index ddfef9f5b89..325b5ad56d6 100644 --- a/dlls/jscript/regexp.c +++ b/dlls/jscript/regexp.c @@ -45,8 +45,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(jscript); #define ReportRegExpErrorHelper(a,b,c,d) throw_error((a)->context, E_FAIL, L"") #define JS_ReportErrorNumber(a,b,c,d) throw_error((a), E_FAIL, L"") #define JS_ReportErrorFlagsAndNumber(a,b,c,d,e,f) throw_error((a), E_FAIL, L"") -#define js_ReportOutOfScriptQuota(a) throw_error((a), E_FAIL, L"") -#define JS_ReportOutOfMemory(a) throw_error((a), E_FAIL, L"") #define JS_COUNT_OPERATION(a,b) throw_error((a), E_FAIL, L"")
@@ -412,7 +410,7 @@ NewRENode(CompilerState *state, REOp op)
ren = heap_pool_alloc(state->pool, sizeof(*ren)); if (!ren) { - /* js_ReportOutOfScriptQuota(cx); */ + throw_error(state->context, E_OUTOFMEMORY, L""); return NULL; } ren->op = op; @@ -1944,7 +1942,7 @@ PushBackTrackState(REGlobalData *gData, REOp op, btincr = ((btincr+btsize-1)/btsize)*btsize; gData->backTrackStack = heap_pool_grow(gData->pool, gData->backTrackStack, btsize, btincr); if (!gData->backTrackStack) { - js_ReportOutOfScriptQuota(gData->cx); + throw_error(gData->cx, E_OUTOFMEMORY, L""); gData->ok = FALSE; return NULL; } @@ -2112,7 +2110,7 @@ ProcessCharSet(REGlobalData *gData, RECharSet *charSet) byteLength = (charSet->length >> 3) + 1; charSet->u.bits = malloc(byteLength); if (!charSet->u.bits) { - JS_ReportOutOfMemory(gData->cx); + throw_error(gData->cx, E_OUTOFMEMORY, L""); gData->ok = FALSE; return FALSE; } @@ -2300,7 +2298,7 @@ ReallocStateStack(REGlobalData *gData)
gData->stateStack = heap_pool_grow(gData->pool, gData->stateStack, sz, sz); if (!gData->stateStack) { - js_ReportOutOfScriptQuota(gData->cx); + throw_error(gData->cx, E_OUTOFMEMORY, L""); gData->ok = FALSE; return FALSE; } @@ -3131,7 +3129,6 @@ static HRESULT InitMatch(regexp_t *re, void *cx, heap_pool_t *pool, REGlobalData return S_OK;
bad: - js_ReportOutOfScriptQuota(cx); gData->ok = FALSE; return E_OUTOFMEMORY; }