blob: bc1529f0c66c12cc9047bb0a76c398ae9448c7c8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
function g(N, p) {
var prefix = p.repeat(N);
var str = prefix + "[AB]";
try {
var re = new RegExp(str);
re.exec(prefix + "A");
} catch(e) {
// 1. Regexp too big is raised by the lack of the 64k virtual registers
// reserved for the regexp evaluation.
// 2. The stack overflow can occur during the analysis of the regexp
assertEq(e.message.includes("regexp too big") ||
e.message.includes("Stack overflow") ||
e.message.includes("too much recursion"), true);
}
}
var prefix = "/(?=k)ok/";
for (var i = 0; i < 18; i++)
g(Math.pow(2, i), prefix)
|