starmath/source/node.cxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
New commits: commit 6091603e3c8794c2959f96309286ed782414bb41 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Fri Dec 16 09:34:13 2022 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Fri Dec 16 11:58:23 2022 +0000 ofz#54365 Integer-overflow Change-Id: Id7202e35bd381e36aa8d36a4ae2c9b987f8e9e79 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144293 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> 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);