mirror of https://github.com/svaarala/duktape.git
Sami Vaarala
4 years ago
4 changed files with 71 additions and 3 deletions
@ -0,0 +1,20 @@ |
|||
// When we revive array index 0 (and 1), array index 2 is always replaced
|
|||
// with a new array. When we walk that array, the same happens, without
|
|||
// limit.
|
|||
|
|||
/*=== |
|||
RangeError |
|||
done |
|||
===*/ |
|||
|
|||
function revive(key, value) { |
|||
this[2] = [ 0, 0, 0 ]; |
|||
return value; |
|||
} |
|||
|
|||
try { |
|||
print(JSON.parse('[1, 2, 3]', revive)); |
|||
} catch (e) { |
|||
print(e.name); |
|||
} |
|||
print('done'); |
@ -0,0 +1,21 @@ |
|||
// When we revive object key .foo, the key .bar is always replaced with a
|
|||
// new object. When we walk that object, the same happens, without limit.
|
|||
// Note that the .bar key must be present when the Walk() algorithm first
|
|||
// enumerates the target object; new keys are not considered.
|
|||
|
|||
/*=== |
|||
RangeError |
|||
done |
|||
===*/ |
|||
|
|||
function revive(key, value) { |
|||
this.bar = { foo: 123, bar: 234 }; |
|||
return value; |
|||
} |
|||
|
|||
try { |
|||
print(JSON.parse('{ "foo": 123, "bar": 234 }', revive)); |
|||
} catch (e) { |
|||
print(e.name); |
|||
} |
|||
print('done'); |
@ -0,0 +1,19 @@ |
|||
/* |
|||
* https://github.com/svaarala/duktape/issues/2338
|
|||
*/ |
|||
|
|||
/*=== |
|||
RangeError |
|||
done |
|||
===*/ |
|||
|
|||
function b() { |
|||
a = Array(3); |
|||
this[2] = a; |
|||
} |
|||
try { |
|||
JSON.parse("[1, 2, []]", b); |
|||
} catch (e) { |
|||
print(e.name); |
|||
} |
|||
print('done'); |
Loading…
Reference in new issue