mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:48:11 +00:00
Shell: Error out when an expression is nested too deep
That can happen with too many nested parenthesis, for instance. This commit sets the maximum allowed limit to 2048 (seems relatively safe for normal code). Found by oss-fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28105&q=label%3AProj-serenity
This commit is contained in:
parent
6394720c87
commit
50b7122798
2 changed files with 4 additions and 0 deletions
|
@ -959,6 +959,9 @@ RefPtr<AST::Node> Parser::parse_list_expression()
|
|||
RefPtr<AST::Node> Parser::parse_expression()
|
||||
{
|
||||
auto rule_start = push_start();
|
||||
if (m_rule_start_offsets.size() > max_allowed_nested_rule_depth)
|
||||
return create<AST::SyntaxError>(String::formatted("Expression nested too deep (max allowed is {})", max_allowed_nested_rule_depth));
|
||||
|
||||
auto starting_char = peek();
|
||||
|
||||
auto read_concat = [&](auto&& expr) -> NonnullRefPtr<AST::Node> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue