jscript: Avoid use after free in JSON_parse().

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2021-08-06 16:56:49 +02:00 committed by Alexandre Julliard
parent 9e725a6d58
commit 6b22f2bd60
1 changed files with 4 additions and 6 deletions

View File

@ -291,16 +291,14 @@ static HRESULT JSON_parse(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsign
parse_ctx.end = buf + jsstr_length(str); parse_ctx.end = buf + jsstr_length(str);
parse_ctx.ctx = ctx; parse_ctx.ctx = ctx;
hres = parse_json_value(&parse_ctx, &ret); hres = parse_json_value(&parse_ctx, &ret);
if(SUCCEEDED(hres) && skip_spaces(&parse_ctx)) {
FIXME("syntax error\n");
hres = E_FAIL;
}
jsstr_release(str); jsstr_release(str);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
if(skip_spaces(&parse_ctx)) {
FIXME("syntax error\n");
jsval_release(ret);
return E_FAIL;
}
if(r) if(r)
*r = ret; *r = ret;
else else