Santino Mazza : jscript: Return ParseProcedureText when compile fails.
Alexandre Julliard
julliard at winehq.org
Wed Jul 20 15:55:32 CDT 2022
Module: wine
Branch: master
Commit: d93712feee25bfe989b5dabcd25759e713a8580a
URL: https://gitlab.winehq.org/wine/wine/-/commit/d93712feee25bfe989b5dabcd25759e713a8580a
Author: Santino Mazza <mazzasantino1206 at gmail.com>
Date: Tue Jul 19 20:49:00 2022 -0300
jscript: Return ParseProcedureText when compile fails.
This prevents crashes when there is an invalid script
inside a tag property.
Because ParseProcedureText calls release_bytecode without
checking if compile_script failed, "code" is not set, and
this leads to a crash when release_bytecode tries to access it.
Signed-off-by: Santino Mazza <mazzasantino1206 at gmail.com>
---
dlls/jscript/jscript.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/dlls/jscript/jscript.c b/dlls/jscript/jscript.c
index 8a54f32f234..190a2876900 100644
--- a/dlls/jscript/jscript.c
+++ b/dlls/jscript/jscript.c
@@ -1197,9 +1197,12 @@ static HRESULT WINAPI JScriptParseProcedure_ParseProcedureText(IActiveScriptPars
enter_script(This->ctx, &ei);
hres = compile_script(This->ctx, pstrCode, dwSourceContextCookie, ulStartingLineNumber, pstrFormalParams,
pstrDelimiter, FALSE, This->is_encode, item, &code);
- if(SUCCEEDED(hres))
- hres = create_source_function(This->ctx, code, &code->global_code, NULL, &dispex);
+ if(FAILED(hres))
+ return leave_script(This->ctx, hres);
+
+ hres = create_source_function(This->ctx, code, &code->global_code, NULL, &dispex);
release_bytecode(code);
+
hres = leave_script(This->ctx, hres);
if(FAILED(hres))
return hres;
More information about the wine-cvs
mailing list