2 * Any copyright is dedicated to the Public Domain.
3 * http://creativecommons.org/licenses/publicdomain/
5 * Author: Christian Holler <decoder@own-hero.net>
9 var foo = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
11 /* Make len(foo) 32768 */
12 for (i = 0; i < 10; ++i) {
16 /* Add one "a" to cause overflow later */
19 var bar = "bbbbbbbbbbbbbbbb";
21 /* Make len(bar) 65536 */
22 for (i = 0; i < 12; ++i) {
27 * Resulting string should be
28 * len(foo)*len(bar) = (2^10 * 32 + 1) * 65536 = 2147549184
29 * which will be negative as jsint
32 foo.replace(/[a]/g, bar);
34 reportCompare(e instanceof InternalError, true, "Internal error due to overallocation is ok.");
36 reportCompare(true, true, "No crash occurred.");
38 print("All tests passed!");