regress-303213.js (1258B)
1 // |reftest| skip-if(!xulRuntime.shell||Android) -- bug 524731 2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 //----------------------------------------------------------------------------- 8 var BUGNUMBER = 303213; 9 var summary = 'integer overflow in js'; 10 var actual = 'No Crash'; 11 var expect = 'No Crash'; 12 13 printBugNumber(BUGNUMBER); 14 printStatus (summary); 15 printStatus('This bug passes if no crash occurs'); 16 17 expectExitCode(0); 18 expectExitCode(5); 19 20 try 21 { 22 var s=String.fromCharCode(257); 23 24 var ki=""; 25 var me=""; 26 for (i = 0; i < 1024; i++) 27 { 28 ki = ki + s; 29 } 30 31 for (i = 0; i < 1024; i++) 32 { 33 me = me + ki; 34 } 35 36 var ov = s; 37 38 for (i = 0; i < 28; i++) 39 ov += ov; 40 41 for (i = 0; i < 88; i++) 42 ov += me; 43 44 printStatus("done generating"); 45 var eov = escape(ov); 46 printStatus("done escape"); 47 printStatus(eov); 48 } 49 catch(ex) 50 { 51 // handle changed 1.9 branch behavior. see bug 422348 52 expect = 'InternalError: allocation size overflow'; 53 actual = ex + ''; 54 } 55 56 reportCompare(expect, actual, summary);