vcl/source/window/syswin.cxx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
New commits: commit f17aec9f573f87e4a8fa5ccdf504897d745bb0a6 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Mon Jul 25 08:25:56 2022 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Mon Jul 25 09:50:45 2022 +0200 vcl: fix assert fail on invalid user input in the vcl::WindowData ctor This seems to be a problem since ea5a0918c8c32309821ab239c4b95f4d6a3b5c12 (VCL add vcl::WindowPosSize abstract class, 2022-06-02), which started asserting that the window size is not negative. Which is fine, but then callers like the vcl::WindowData ctor has to be adapted, since they get user input. My user profile had a string like: "1056298152,1049249376,-1906262000,-1906261808;5;0,0,0,0;" passed to that ctor, so soffice failed to start up. Just ignore the broken user input at the call-site. Change-Id: I942b0f2dfc1a07f9514c120761e100691f6d1a59 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137357 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx index 5a5baf380e71..7ccc545c9fa6 100644 --- a/vcl/source/window/syswin.cxx +++ b/vcl/source/window/syswin.cxx @@ -430,7 +430,11 @@ vcl::WindowData::WindowData(std::string_view rStr) aTokenStr = o3tl::getToken(rStr, 0, ',', nIndex); if (!aTokenStr.empty()) { - rData.setWidth(o3tl::toInt32(aTokenStr)); + sal_Int32 nWidth = o3tl::toInt32(aTokenStr); + if (nWidth >= 0) + { + rData.setWidth(nWidth); + } if (rData.width() > 0 && rData.width() < 16384) nValidMask |= vcl::WindowDataMask::Width; else @@ -441,7 +445,11 @@ vcl::WindowData::WindowData(std::string_view rStr) aTokenStr = o3tl::getToken(rStr, 0, ';', nIndex); if (!aTokenStr.empty()) { - rData.setHeight(o3tl::toInt32(aTokenStr)); + sal_Int32 nHeight = o3tl::toInt32(aTokenStr); + if (nHeight >= 0) + { + rData.setHeight(nHeight); + } if (rData.height() > 0 && rData.height() < 16384) nValidMask |= vcl::WindowDataMask::Height; else