mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
LibGUI: Check that AutocompleteBox's selection row is valid
Previously we didn't check that the selection's row index is in a valid range before attempting to access its data via the model. This could cause an out-of-bounds access to the model's Vector of suggestions. I think this should fix #7404, but I can't verify it does because I wasn't able to reproduce it on my machine.
This commit is contained in:
parent
7a4445a1fe
commit
7c2941d4ea
Notes:
sideshowbarker
2024-07-18 17:05:45 +09:00
Author: https://github.com/itamar8910 Commit: https://github.com/SerenityOS/serenity/commit/7c2941d4ea8 Pull-request: https://github.com/SerenityOS/serenity/pull/7453 Issue: https://github.com/SerenityOS/serenity/issues/7404 Reviewed-by: https://github.com/alimpfard Reviewed-by: https://github.com/awesomekling
1 changed files with 1 additions and 1 deletions
|
@ -168,7 +168,7 @@ void AutocompleteBox::apply_suggestion()
|
|||
return;
|
||||
|
||||
auto selected_index = m_suggestion_view->selection().first();
|
||||
if (!selected_index.is_valid())
|
||||
if (!selected_index.is_valid() || !m_suggestion_view->model()->is_valid(selected_index))
|
||||
return;
|
||||
|
||||
auto suggestion_index = m_suggestion_view->model()->index(selected_index.row(), AutocompleteSuggestionModel::Column::Name);
|
||||
|
|
Loading…
Reference in a new issue