diff options
Diffstat (limited to 'js/src/jit-test/tests/regexp/huge-01.js')
-rw-r--r-- | js/src/jit-test/tests/regexp/huge-01.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/regexp/huge-01.js b/js/src/jit-test/tests/regexp/huge-01.js new file mode 100644 index 0000000000..bc1529f0c6 --- /dev/null +++ b/js/src/jit-test/tests/regexp/huge-01.js @@ -0,0 +1,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) |