From 78e86d879fa9bf3afeb73b29a3e668d47df5e9ab Mon Sep 17 00:00:00 2001 From: Matteo Golinelli <34921879+Golim@users.noreply.github.com> Date: Tue, 2 Sep 2025 13:16:26 +0200 Subject: [PATCH] config: fix crash when monitor position contains non-integer values before/after 'x' (#11573) --- src/config/ConfigManager.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 3e75f2ab3..9277b89be 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -2196,8 +2196,14 @@ bool CMonitorRuleParser::parsePosition(const std::string& value, bool isFirst) { m_rule.offset = Vector2D(-INT32_MAX, -INT32_MAX); return false; } else { - m_rule.offset.x = stoi(value.substr(0, value.find_first_of('x'))); - m_rule.offset.y = stoi(value.substr(value.find_first_of('x') + 1)); + try { + m_rule.offset.x = stoi(value.substr(0, value.find_first_of('x'))); + m_rule.offset.y = stoi(value.substr(value.find_first_of('x') + 1)); + } catch (...) { + m_error += "invalid offset "; + m_rule.offset = Vector2D(-INT32_MAX, -INT32_MAX); + return false; + } } } return true;