[Libreoffice-commits] core.git: vcl/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Thu Mar 26 10:12:47 UTC 2020
vcl/source/window/toolbox.cxx | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
New commits:
commit 2c033abfb010201c453f84373969f0a3b746be7b
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Mar 26 09:25:20 2020 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Mar 26 11:12:12 2020 +0100
ubsan with negative long width divided by size_t
vcl/source/window/toolbox.cxx:3565:62: runtime error: signed integer overflow: 150 + 9223372036854775679 cannot be represented in type 'long'
> #0 0x2b9111e92f60 in ToolBox::Resize() vcl/source/window/toolbox.cxx:3565:62
> #1 0x2b9111770f39 in vcl::Window::ImplCallResize() vcl/source/window/event.cxx:533:5
> #2 0x2b9111fc9aff in vcl::Window::ImplPosSizeWindow(long, long, long, long, PosSizeFlags) vcl/source/window/window.cxx:1631:17
Change-Id: I5b74e8eaa65617cfa74b735491602b1c240dff62
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91089
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index deece3481460..c7ba32cc9527 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -3551,9 +3551,10 @@ void ToolBox::Resize()
aBounds.Union( rItem.maRect );
}
- long nOptimalWidth = aBounds.GetWidth();
- long nDiff = aSize.Width() - nOptimalWidth;
- nDiff /= aExpandables.size();
+ auto nOptimalWidth = aBounds.GetWidth();
+ auto nDiff = aSize.Width() - nOptimalWidth;
+ decltype(nDiff) nExpandablesSize = aExpandables.size();
+ nDiff /= nExpandablesSize;
//share out the diff from optimal to real across
//expandable entries
More information about the Libreoffice-commits
mailing list