Skip to content

Commit d8ea7df

Browse files
authored
Reject date strings with negative year zero (#100)
1 parent 5ce2957 commit d8ea7df

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

quickjs.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46154,8 +46154,11 @@ static int string_get_signed_digits(JSString *sp, int *pp, int64_t *pval) {
4615446154
p++;
4615546155

4615646156
res = string_get_digits(sp, &p, pval);
46157-
if (res == 0 && sgn == '-')
46157+
if (res == 0 && sgn == '-') {
46158+
if (*pval == 0)
46159+
return -1; // reject negative zero
4615846160
*pval = -*pval;
46161+
}
4615946162
*pp = p;
4616046163
return res;
4616146164
}

test262_errors.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ test262/test/built-ins/AsyncGeneratorPrototype/return/return-suspendedStart-brok
55
test262/test/built-ins/AsyncGeneratorPrototype/return/return-suspendedStart-broken-promise.js:34: strict mode: TypeError: $DONE() not called
66
test262/test/built-ins/AsyncGeneratorPrototype/return/return-suspendedYield-broken-promise-try-catch.js:39: TypeError: $DONE() not called
77
test262/test/built-ins/AsyncGeneratorPrototype/return/return-suspendedYield-broken-promise-try-catch.js:39: strict mode: TypeError: $DONE() not called
8-
test262/test/built-ins/Date/parse/year-zero.js:13: Test262Error: reject minus zero as extended year Expected SameValue(«-62159440500000», «NaN») to be true
9-
test262/test/built-ins/Date/parse/year-zero.js:13: strict mode: Test262Error: reject minus zero as extended year Expected SameValue(«-62159440500000», «NaN») to be true
108
test262/test/built-ins/Date/prototype/setDate/arg-coercion-order.js:28: Test262Error: ToNumber invoked exactly once Expected SameValue(«0», «1») to be true
119
test262/test/built-ins/Date/prototype/setDate/arg-coercion-order.js:28: strict mode: Test262Error: ToNumber invoked exactly once Expected SameValue(«0», «1») to be true
1210
test262/test/built-ins/Date/prototype/setHours/arg-coercion-order.js:57: Test262Error: Expected [] and [valueOf hour, valueOf min, valueOf sec, valueOf ms] to have the same contents.
@@ -31,8 +29,6 @@ test262/test/built-ins/Date/prototype/setUTCMonth/arg-coercion-order.js:34: Test
3129
test262/test/built-ins/Date/prototype/setUTCMonth/arg-coercion-order.js:34: strict mode: Test262Error: Expected [] and [valueOf month, valueOf date] to have the same contents.
3230
test262/test/built-ins/Date/prototype/setUTCSeconds/arg-coercion-order.js:34: Test262Error: Expected [] and [valueOf sec, valueOf ms] to have the same contents.
3331
test262/test/built-ins/Date/prototype/setUTCSeconds/arg-coercion-order.js:34: strict mode: Test262Error: Expected [] and [valueOf sec, valueOf ms] to have the same contents.
34-
test262/test/built-ins/Date/year-zero.js:13: Test262Error: reject minus zero as extended year Expected SameValue(«-62159440500000», «NaN») to be true
35-
test262/test/built-ins/Date/year-zero.js:13: strict mode: Test262Error: reject minus zero as extended year Expected SameValue(«-62159440500000», «NaN») to be true
3632
test262/test/built-ins/Function/internals/Construct/derived-this-uninitialized-realm.js:20: Test262Error: Expected a ReferenceError but got a different error constructor with the same name
3733
test262/test/built-ins/Function/internals/Construct/derived-this-uninitialized-realm.js:20: strict mode: Test262Error: Expected a ReferenceError but got a different error constructor with the same name
3834
test262/test/built-ins/RegExp/lookahead-quantifier-match-groups.js:27: Test262Error: Expected [a, abc] and [a, undefined] to have the same contents. ? quantifier

0 commit comments

Comments
 (0)