mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 18:20:43 +09:00
Spreadsheet: Do not assume that user input has balanced parenthesis
Otherwise people with broken paren keys, or people with entertaining ideas like "=9\b)" will cause an assert to trip. Fixes #5909.
This commit is contained in:
parent
677e5e4d84
commit
fef165f1d2
Notes:
sideshowbarker
2024-07-18 21:08:38 +09:00
Author: https://github.com/alimpfard
Commit: fef165f1d2
Pull-request: https://github.com/SerenityOS/serenity/pull/5912
Issue: https://github.com/SerenityOS/serenity/issues/4822
Issue: https://github.com/SerenityOS/serenity/issues/5905
Issue: https://github.com/SerenityOS/serenity/issues/5909
Issue: https://github.com/SerenityOS/serenity/issues/5910
1 changed files with 6 additions and 1 deletions
|
@ -64,6 +64,10 @@ Optional<FunctionAndArgumentIndex> get_function_and_argument_index(StringView so
|
|||
case JS::TokenType::ParenClose:
|
||||
previous_was_identifier = false;
|
||||
if (open_parens_since_last_commit == 0) {
|
||||
if (state.is_empty() || names.is_empty()) {
|
||||
// JS Syntax error.
|
||||
break;
|
||||
}
|
||||
state.take_last();
|
||||
names.take_last();
|
||||
break;
|
||||
|
@ -73,7 +77,8 @@ Optional<FunctionAndArgumentIndex> get_function_and_argument_index(StringView so
|
|||
case JS::TokenType::Comma:
|
||||
previous_was_identifier = false;
|
||||
if (open_parens_since_last_commit == 0 && open_curlies_and_brackets_since_last_commit == 0) {
|
||||
state.last()++;
|
||||
if (!state.is_empty())
|
||||
state.last()++;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue