mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-30 18:33:52 +00:00
fix: guard std::stoi/stof calls at input boundaries against exceptions
Wrap string-to-number conversions in try-catch where input comes from external sources (realm address port, last_world.cfg, keybinding config, ADT tile filenames) to prevent crashes on malformed data.
This commit is contained in:
parent
ee20f823f7
commit
ff77febb36
3 changed files with 23 additions and 11 deletions
|
|
@ -192,10 +192,12 @@ void KeybindingManager::loadFromConfigFile(const std::string& filePath) {
|
|||
key = ImGuiKey_End;
|
||||
} else if (keyStr.find("F") == 0 && keyStr.length() <= 3) {
|
||||
// F1-F12 keys
|
||||
int fNum = std::stoi(keyStr.substr(1));
|
||||
if (fNum >= 1 && fNum <= 12) {
|
||||
key = static_cast<ImGuiKey>(ImGuiKey_F1 + (fNum - 1));
|
||||
}
|
||||
try {
|
||||
int fNum = std::stoi(keyStr.substr(1));
|
||||
if (fNum >= 1 && fNum <= 12) {
|
||||
key = static_cast<ImGuiKey>(ImGuiKey_F1 + (fNum - 1));
|
||||
}
|
||||
} catch (...) {}
|
||||
}
|
||||
|
||||
if (key == ImGuiKey_None) continue;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue