Bug 195970 - [Yarr Interpreter] The interpreter doesn't have checks for stack overflow due to deep recursion
Summary: [Yarr Interpreter] The interpreter doesn't have checks for stack overflow due...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-19 15:54 PDT by Michael Saboff
Modified: 2019-03-19 15:54 PDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Saboff 2019-03-19 15:54:16 PDT
RegExp patterns can be nested deep via parentheses, e.g. (((((((((((x))))))))))).  The parsing and compiling of such a pattern as well as the processing by the JIT and interpreter uses recursion.  For deeply nested pattern or patterns that as process when called from an already deep stack, we can exceed the available stack space.  The pattern parse / compilation paths are already handled.  The JIT compilation paths are being tracked in <https://bugs.webkit.org/show_bug.cgi?id=195906> "JSC test crash: stress/dont-strength-reduce-regexp-with-compile-error.js.default".  This bug is for the interpreter, specifically recursion of Yarr::Interpreter::matchDisjunction().  There currently isn't a test case that produces a crash from the interpreter, but code inspection shows that there aren't any "is it safe to recurse?" checks.  It could be the case that it takes a deeper stack to pasrse / compile a  pattern than it does to interpret it.