vcl/source/window/layout.cxx | 5 +++++ 1 file changed, 5 insertions(+)
New commits: commit 06aaa1c81b2e927f575abd4d2a6e0d134f459aa5 Author: Tor Lillqvist <[email protected]> AuthorDate: Tue Jan 18 15:33:04 2022 +0200 Commit: Tor Lillqvist <[email protected]> CommitDate: Wed Jan 19 10:11:25 2022 +0100 Add sanity check to avoid crash in the Collabora Online server Make sure some coordinates don't become huge negative numbers. This doesn't fix the unknown root cause of course. Change-Id: I28e343271b3f80ac203b52db1be58d2add89eecd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128558 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Jan Holesovsky <[email protected]> diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index 0018971e0f5c..cb89f0f5fee2 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -643,6 +643,11 @@ void VclButtonBox::setAllocation(const Size &rAllocation) tools::Long nMainPrimaryDimension = getPrimaryDimension( addSpacing(aReq.m_aMainGroupSize, aReq.m_aMainGroupDimensions.size())); tools::Long nExtraSpace = nAllocPrimaryDimension - nMainPrimaryDimension; + if (nExtraSpace < 0) + { + SAL_WARN("vcl.layout", "nExtra space went negative, setting to zero"); + nExtraSpace = 0; + } nExtraSpace += (aReq.m_aMainGroupDimensions.size()-1) * nSpacing; nSpacing = nExtraSpace/(aReq.m_aMainGroupDimensions.size()+1); setPrimaryCoordinate(aMainGroupPos, nSpacing);
