Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 // |reftest| skip-if(!xulRuntime.shell&&(Android||xulRuntime.OS=="WINNT")) silentfail
2 /*
3 * Any copyright is dedicated to the Public Domain.
4 * http://creativecommons.org/licenses/publicdomain/
5 *
6 * Author: Christian Holler <decoder@own-hero.net>
7 */
9 expectExitCode(0);
10 expectExitCode(5);
12 /* Length of 32 */
13 var foo = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
15 /* Make len(foo) 32768 */
16 for (i = 0; i < 10; ++i) {
17 foo += foo;
18 }
20 /* Add one "a" to cause overflow later */
21 foo += "a";
23 var bar = "bbbbbbbbbbbbbbbb";
25 /* Make len(bar) 8192 */
26 for (i = 0; i < 9; ++i) {
27 bar += bar;
28 }
30 /*
31 * Resulting string should be
32 * len(foo) * len(bar) = (2**10 * 32 + 1) * 8192 = 268443648
33 * which will be larger than the max string length (2**28, or 268435456).
34 */
35 try {
36 foo.replace(/[a]/g, bar);
37 } catch (e) {
38 reportCompare(e instanceof InternalError, true, "Internal error due to overallocation is ok.");
39 }
40 reportCompare(true, true, "No crash occurred.");
42 print("Tests complete");