regress-230216-2.js (1075B)
1 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 //----------------------------------------------------------------------------- 7 var BUGNUMBER = 230216; 8 var summary = 'check for numerical overflow in regexps in back reference and bounds for {} quantifier'; 9 var actual = ''; 10 var expect = ''; 11 var status = ''; 12 13 DESCRIPTION = summary; 14 15 printBugNumber(BUGNUMBER); 16 printStatus (summary); 17 18 status = inSection(1) + ' check for overflow in quantifier'; 19 20 actual = 'undefined'; 21 expect0 = 'no exception thrown false'; 22 expect1 = 'error'; 23 24 try 25 { 26 var result = eval('/a{21474836481}/.test("a")'); 27 actual = 'no exception thrown ' + result; 28 status += ' result: ' + result; 29 } 30 catch(e) 31 { 32 actual = 'error'; 33 } 34 35 // The result we get depends on the regexp engine. 36 if (actual != 'error') 37 reportCompare(expect0, actual, status); 38 else 39 reportCompare(expect1, actual, status);