ladybird/Userland/Shell
Ben Wiederhake 48e4fb239a Shell: Prevent exponential explosion around '$(('
When parse_expression looks at '$((', there are two ways it can end up
in parse_expression again, three consumed characters later. All these
ways fail, so what happened was that the parser tried all possible
combinations, hence taking potentially an exponential amount of time.

1. parse_evaluate swallows the '$(', a new invocation of
   parse_expression swallows the other '(', and through
   parse_list_expression we're at another parse_expression.
2. parse_evaluate swallows the '$(', but returns a SyntaxError.
   parse_expression used to not recognize the error, and treated it as a
   regular AST node, calling into read_concat, then a new invocation of
   parse_expression swallows the other '(', and through
   parse_list_expression we're at another parse_expression.

Fixes #10561.

Found by OSS Fuzz, long-standing issue
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28113
2021-10-23 19:29:59 +01:00
..
Tests Tests: Run each test in their respective directories 2021-06-22 18:54:40 +04:30
AST.cpp Shell: Raise an error if an execute node ends up trying to run nothing 2021-10-11 10:56:01 +03:30
AST.h Shell: Use default instead of an empty constructor/destructor 2021-09-16 17:17:13 +02:00
Builtin.cpp Shell: Fix -Wunreachable-code warnings from clang 2021-10-08 23:33:46 +02:00
CMakeLists.txt Everywhere: Add component declarations 2021-06-17 11:03:51 +02:00
Execution.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
Formatter.cpp Shell: Convert StringBuilder::appendf() => AK::Format 2021-05-07 21:12:09 +02:00
Formatter.h Shell: Implement formatting for Heredocs 2021-04-29 20:25:56 +02:00
Forward.h Shell: Add support for heredocs 2021-04-29 20:25:56 +02:00
ImmediateFunctions.cpp AK: Rename create<T> => make_ref_counted<T> 2021-09-03 02:36:09 +02:00
Job.cpp Everywhere: Use "the SerenityOS developers." in copyright headers 2021-04-29 00:59:26 +02:00
Job.h Shell: Hide job times behind SHELL_JOB_DEBUG flag 2021-05-21 12:05:34 +04:30
main.cpp Shell: Remove dbgln related to process group IDs 2021-08-12 22:42:50 +02:00
NodeVisitor.cpp Shell: Add support for heredocs 2021-04-29 20:25:56 +02:00
NodeVisitor.h Shell: Add support for heredocs 2021-04-29 20:25:56 +02:00
Parser.cpp Shell: Prevent exponential explosion around '$((' 2021-10-23 19:29:59 +01:00
Parser.h Shell: Prevent exponential explosion around '$((' 2021-10-23 19:29:59 +01:00
Shell.cpp Everywhere: Make ByteBuffer::{create_*,copy}() OOM-safe 2021-09-06 01:53:26 +02:00
Shell.h Everywhere: Make ByteBuffer::{create_*,copy}() OOM-safe 2021-09-06 01:53:26 +02:00
SyntaxHighlighter.cpp LibWeb+LibSyntax: Implement nested syntax highlighters 2021-06-07 14:45:49 +04:30
SyntaxHighlighter.h LibWeb+LibSyntax: Implement nested syntax highlighters 2021-06-07 14:45:49 +04:30