diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2022-06-25 19:06:59 +0430 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-06-26 22:21:17 +0100 |
commit | 0e2f4c50d3c7719115710d72d3ec006b0b719c5e (patch) | |
tree | 413bf5fc004a71ea2485af89bfe20bcb00c64385 /Userland/Applications | |
parent | b691269912bcc08e43007d03c04e784b6b4974a8 (diff) | |
download | serenity-0e2f4c50d3c7719115710d72d3ec006b0b719c5e.zip |
Spreadsheet: Prevent OOB access to text editor buffer
For some reason LibGUI sends two events for each edit, and one of them
contains an OOB cursor if a character was deleted.
This works around that for now.
Diffstat (limited to 'Userland/Applications')
-rw-r--r-- | Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp index 330a3d14ed..dbc58e0519 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp @@ -383,6 +383,7 @@ void SpreadsheetWidget::try_generate_tip_for_input_expression(StringView source, m_inline_documentation_window->hide(); return; } + cursor_offset = min(cursor_offset, source.length()); auto maybe_function_and_argument = get_function_and_argument_index(source.substring_view(0, cursor_offset)); if (!maybe_function_and_argument.has_value()) { m_inline_documentation_window->hide(); |