Skip to content
Permalink
Browse files
Reduce array length for memory limited scenarios in regexp-bol-optimi…
…ze-out-of-stack.js

https://bugs.webkit.org/show_bug.cgi?id=240717

Patch by Xan López <xan@igalia.com> on 2022-05-20
Reviewed by Yusuke Suzuki.

* stress/regexp-bol-optimize-out-of-stack.js: use a smaller array size when memory is limited.
(test):

Canonical link: https://commits.webkit.org/250826@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294595 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
xanlpz authored and webkit-commit-queue committed May 21, 2022
1 parent 2969827 commit 6b07b8bc6e0e5aaac87b1c8373d52e8fe1f942c1
Showing 1 changed file with 4 additions and 1 deletion.
@@ -1,10 +1,13 @@
// This test that the beginning of line (bol) optimization throws when we run out of stack space.
//@ requireOptions("-e", "let arrayLength=25000") if $memoryLimited

arrayLength = typeof(arrayLength) === 'undefined' ? 50000 : arrayLength;

let expectedException = "SyntaxError: Invalid regular expression: regular expression too large";

function test()
{
let source = Array(50000).join("(") + /(?:^|:|,)(?:\s*\[)+/g.toString() + Array(50000).join(")");
let source = Array(arrayLength).join("(") + /(?:^|:|,)(?:\s*\[)+/g.toString() + Array(arrayLength).join(")");
RegExp(source);
}

0 comments on commit 6b07b8b

Please sign in to comment.