Commit c0e8f166 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

jscript: Throw proper error for out of memory conditions in RegExp.

parent e7b06b0d
...@@ -45,8 +45,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(jscript); ...@@ -45,8 +45,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(jscript);
#define ReportRegExpErrorHelper(a,b,c,d) throw_error((a)->context, E_FAIL, L"") #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_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_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"") #define JS_COUNT_OPERATION(a,b) throw_error((a), E_FAIL, L"")
...@@ -412,7 +410,7 @@ NewRENode(CompilerState *state, REOp op) ...@@ -412,7 +410,7 @@ NewRENode(CompilerState *state, REOp op)
ren = heap_pool_alloc(state->pool, sizeof(*ren)); ren = heap_pool_alloc(state->pool, sizeof(*ren));
if (!ren) { if (!ren) {
/* js_ReportOutOfScriptQuota(cx); */ throw_error(state->context, E_OUTOFMEMORY, L"");
return NULL; return NULL;
} }
ren->op = op; ren->op = op;
...@@ -1944,7 +1942,7 @@ PushBackTrackState(REGlobalData *gData, REOp op, ...@@ -1944,7 +1942,7 @@ PushBackTrackState(REGlobalData *gData, REOp op,
btincr = ((btincr+btsize-1)/btsize)*btsize; btincr = ((btincr+btsize-1)/btsize)*btsize;
gData->backTrackStack = heap_pool_grow(gData->pool, gData->backTrackStack, btsize, btincr); gData->backTrackStack = heap_pool_grow(gData->pool, gData->backTrackStack, btsize, btincr);
if (!gData->backTrackStack) { if (!gData->backTrackStack) {
js_ReportOutOfScriptQuota(gData->cx); throw_error(gData->cx, E_OUTOFMEMORY, L"");
gData->ok = FALSE; gData->ok = FALSE;
return NULL; return NULL;
} }
...@@ -2112,7 +2110,7 @@ ProcessCharSet(REGlobalData *gData, RECharSet *charSet) ...@@ -2112,7 +2110,7 @@ ProcessCharSet(REGlobalData *gData, RECharSet *charSet)
byteLength = (charSet->length >> 3) + 1; byteLength = (charSet->length >> 3) + 1;
charSet->u.bits = malloc(byteLength); charSet->u.bits = malloc(byteLength);
if (!charSet->u.bits) { if (!charSet->u.bits) {
JS_ReportOutOfMemory(gData->cx); throw_error(gData->cx, E_OUTOFMEMORY, L"");
gData->ok = FALSE; gData->ok = FALSE;
return FALSE; return FALSE;
} }
...@@ -2300,7 +2298,7 @@ ReallocStateStack(REGlobalData *gData) ...@@ -2300,7 +2298,7 @@ ReallocStateStack(REGlobalData *gData)
gData->stateStack = heap_pool_grow(gData->pool, gData->stateStack, sz, sz); gData->stateStack = heap_pool_grow(gData->pool, gData->stateStack, sz, sz);
if (!gData->stateStack) { if (!gData->stateStack) {
js_ReportOutOfScriptQuota(gData->cx); throw_error(gData->cx, E_OUTOFMEMORY, L"");
gData->ok = FALSE; gData->ok = FALSE;
return FALSE; return FALSE;
} }
...@@ -3131,7 +3129,6 @@ static HRESULT InitMatch(regexp_t *re, void *cx, heap_pool_t *pool, REGlobalData ...@@ -3131,7 +3129,6 @@ static HRESULT InitMatch(regexp_t *re, void *cx, heap_pool_t *pool, REGlobalData
return S_OK; return S_OK;
bad: bad:
js_ReportOutOfScriptQuota(cx);
gData->ok = FALSE; gData->ok = FALSE;
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment