fixed negative zero date

This commit is contained in:
Fabrice Bellard
2023-12-09 12:26:37 +01:00
parent 55a4878a60
commit b14d77be5b
2 changed files with 4 additions and 5 deletions

View File

@@ -48100,8 +48100,11 @@ static int string_get_signed_digits(JSString *sp, int *pp, int64_t *pval) {
p++;
res = string_get_digits(sp, &p, pval);
if (res == 0 && sgn == '-')
if (res == 0 && sgn == '-') {
if (*pval == 0)
return -1; // reject negative zero
*pval = -*pval;
}
*pp = p;
return res;
}