You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

30 lines
518 B

/*
* Duktape 0.11.0 had a bug where setting a year outside the Ecmascript
* range could overflow in integer arithmetic, resulting in an incorrect
* year being set. The test would print:
*
* -093243-12-05T00:00:00.000Z
* done
*/
/*===
RangeError
done
===*/
function test() {
var d = new Date(0);
d.setUTCFullYear(-200e6);
try {
print(d.toISOString());
} catch (e) {
print(e.name);
}
}
try {
test();
} catch (e) {
print(e.stack || e);
}
print('done');