summaryrefslogtreecommitdiff
path: root/starmath/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-12-16 09:34:13 +0000
committerCaolán McNamara <caolanm@redhat.com>2022-12-16 11:58:23 +0000
commit6091603e3c8794c2959f96309286ed782414bb41 (patch)
tree5d8b942987bf184a2225019f64e58e8c4056a484 /starmath/source
parent99ed51bcad4008a4006dcec24aa33fd7f757a433 (diff)
ofz#54365 Integer-overflow
Change-Id: Id7202e35bd381e36aa8d36a4ae2c9b987f8e9e79 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144293 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'starmath/source')
-rw-r--r--starmath/source/node.cxx11
1 files changed, 9 insertions, 2 deletions
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index eddde9f18f2d..5beab34c731d 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -25,6 +25,7 @@
#include <visitors.hxx>
#include <tools/UnitConversion.hxx>
#include <vcl/metric.hxx>
+#include <o3tl/safeint.hxx>
#include <osl/diagnose.h>
#include <basegfx/numeric/ftools.hxx>
@@ -835,8 +836,14 @@ void SmBinHorNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat)
const SmRect &rOpRect = pOper->GetRect();
- tools::Long nDist = (rOpRect.GetWidth() *
- rFormat.GetDistance(DIS_HORIZONTAL)) / 100;
+ tools::Long nMul;
+ if (o3tl::checked_multiply<tools::Long>(rOpRect.GetWidth(), rFormat.GetDistance(DIS_HORIZONTAL), nMul))
+ {
+ SAL_WARN("starmath", "integer overflow");
+ return;
+ }
+
+ tools::Long nDist = nMul / 100;
SmRect::operator = (*pLeft);