From 8671390576e9dd971e3ec20f8650f821372aeb95 Mon Sep 17 00:00:00 2001 From: brunoherbelin Date: Sun, 30 Nov 2025 09:02:46 +0100 Subject: [PATCH] BugFix prevent out-of-bounds access in settings --- src/Settings.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Settings.cpp b/src/Settings.cpp index 8fb24ac..b04f4d9 100644 --- a/src/Settings.cpp +++ b/src/Settings.cpp @@ -18,6 +18,7 @@ **/ +#include #include #include "Toolkit/tinyxml2Toolkit.h" using namespace tinyxml2; @@ -732,7 +733,10 @@ void Settings::Load(const std::string &filename) { glm::vec2 val; tinyxml2::XMLElementToGLM( strengthNode, val); - application.mouse_pointer_strength[ (size_t) ceil(val.x) ] = val.y; + size_t i = (size_t) ceil(val.x); + if (i >= application.mouse_pointer_strength.size()) + application.mouse_pointer_strength.resize(i + 1, 0.f); + application.mouse_pointer_strength[ i ] = val.y; } }