Fixed several container overflows in GuiTextEditKeyboardPopup that could lead to rare crashes when running on an ARM processor

This commit is contained in:
Leon Styhre 2023-03-12 12:13:49 +01:00
parent f8dc7559ce
commit 608d8a3c09

View file

@ -41,7 +41,7 @@
#include "utils/StringUtil.h"
// clang-format off
std::vector<std::vector<const char*>> kbBaseUS {
std::vector<std::vector<std::string>> kbBaseUS {
{"1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", "DEL"},
{"!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "+", "DEL"},
{"¡", "²", "³", "¤", "", "¼", "½", "¾", "", "", "¥", "×", "DEL"},
@ -62,13 +62,13 @@ std::vector<std::vector<const char*>> kbBaseUS {
{"", "æ", "", "©", "", "", "ñ", "µ", "ç", "", "¿", "ALT", "-colspan-"},
{"", "Æ", "", "¢", "", "", "Ñ", "Μ", "Ç", "", "", "ALT", "-colspan-"}};
std::vector<std::vector<const char*>> kbLastRowNormal {
std::vector<std::vector<std::string>> kbLastRowNormal {
{"SHIFT", "-colspan-", "SPACE", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "CLEAR", "-colspan-", "CANCEL", "-colspan-"},
{"SHIFT", "-colspan-", "SPACE", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "CLEAR", "-colspan-", "CANCEL", "-colspan-"},
{"SHIFT", "-colspan-", "SPACE", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "CLEAR", "-colspan-", "CANCEL", "-colspan-"},
{"SHIFT", "-colspan-", "SPACE", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "CLEAR", "-colspan-", "CANCEL", "-colspan-"}};
std::vector<std::vector<const char*>> kbLastRowLoad {
std::vector<std::vector<std::string>> kbLastRowLoad {
{"SHIFT", "-colspan-", "SPACE", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "LOAD", "-colspan-", "CLEAR", "-colspan-", "CANCEL", "-colspan-"},
{"SHIFT", "-colspan-", "SPACE", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "LOAD", "-colspan-", "CLEAR", "-colspan-", "CANCEL", "-colspan-"},
{"SHIFT", "-colspan-", "SPACE", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "LOAD", "-colspan-", "CLEAR", "-colspan-", "CANCEL", "-colspan-"},
@ -117,7 +117,7 @@ GuiTextEditKeyboardPopup::GuiTextEditKeyboardPopup(
mTitle = std::make_shared<TextComponent>(Utils::String::toUpper(title),
Font::get(FONT_SIZE_LARGE), 0x555555FF, ALIGN_CENTER);
std::vector<std::vector<const char*>> kbLayout;
std::vector<std::vector<std::string>> kbLayout;
// At the moment there is only the US keyboard layout available.
kbLayout.insert(kbLayout.cend(), kbBaseUS.cbegin(), kbBaseUS.cend());