Separate testcases for 32K boundary in regexp bytecode jump offset and 64K boundary of [] offset in regexp search string. bug 280769

git-svn-id: svn://10.0.0.236/trunk@170047 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bob%bclary.com 2005-03-01 17:08:17 +00:00
parent dc5e60fdfd
commit 82be7ec14b
2 changed files with 29 additions and 31 deletions

View File

@ -37,36 +37,20 @@
* ***** END LICENSE BLOCK ***** */
//-----------------------------------------------------------------------------
var bug = 280769;
var summary = 'Do not crash on regular expression class count overflow';
var summary = 'Do not crash on overflow of 64K boundary of [] offset in regexp search string ';
var actual = 'No Crash';
var expect = 'No Crash';
printBugNumber (bug);
printStatus (summary);
function crash(N)
{
var a = new Array(N);
status = summary + ' ' + inSection(1) + ' (new RegExp("zzz...[AB]").exec("zzz...A") ';
for (var i = 0; i != N; ++i) {
a[i] = i;
}
var N = 100 * 1000; // N should be more then 64K
var a = new Array(N + 1);
var prefix = a.join("z"); // prefix is sequence of N "z", zzz...zzz
var str = prefix+"[AB]"; // str is zzz...zzz[AB]
var re = new RegExp(str);
re.exec(prefix+"A");
var str = '['+a.join('][')+']'; // str is [0][1][2]...[<PRINTED N-1>]
var re = new RegExp(str);
re.exec("");
}
status = summary + ' ' + inSection(1) + ' N = 20000 ';
crash(20000);
reportCompare(expect, actual, status);
status = summary + ' ' + inSection(2) + ' N = 0xFFFF ';
crash(0xFFFF);
reportCompare(expect, actual, status);
status = summary + ' ' + inSection(3) + ' N = 100000 ';
crash(100000);
reportCompare(expect, actual, status);

File diff suppressed because one or more lines are too long