Commit b9a57de0 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Use parse_decimal for parsing JSON numeric literals starting with 0.

parent 9240ed58
......@@ -261,19 +261,12 @@ static HRESULT parse_json_value(json_parse_ctx_t *ctx, jsval_t *r)
skip_spaces(ctx);
}
if(!isdigitW(*ctx->ptr))
if(*ctx->ptr == '0' && ctx->ptr + 1 < ctx->end && isdigitW(ctx->ptr[1]))
break;
if(*ctx->ptr == '0') {
ctx->ptr++;
n = 0;
if(is_identifier_char(*ctx->ptr))
break;
}else {
hres = parse_decimal(&ctx->ptr, ctx->end, &n);
if(FAILED(hres))
return hres;
}
hres = parse_decimal(&ctx->ptr, ctx->end, &n);
if(FAILED(hres))
break;
*r = jsval_number(sign*n);
return S_OK;
......
......@@ -1887,7 +1887,10 @@ ok(isNaN(tmp), "Math.tan(-Infinity) is not NaN");
["[false,{},{\"x\": []}]", [false,{},{x:[]}]],
["0", 0],
["- 1", -1],
["1e2147483648", Infinity]
["1e2147483648", Infinity],
["0.5", 0.5],
["0e5", 0],
[".5", 0.5]
];
function json_cmp(x, y) {
......
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