starmath/source/node.cxx | 6 ++++++
1 file changed, 6 insertions(+)
New commits:
commit cd9602dcc51a7ce54fadf9796642ee9d7fcf3cfe
Author: Caolán McNamara <[email protected]>
AuthorDate: Sat Apr 30 20:03:51 2022 +0100
Commit: Caolán McNamara <[email protected]>
CommitDate: Sun May 1 15:42:56 2022 +0200
ofz#47162 Integer-overflow
Change-Id: I4d910a1844100415f95c89bda83843ddffdc3df0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133663
Tested-by: Caolán McNamara <[email protected]>
Reviewed-by: Caolán McNamara <[email protected]>
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index a13f5deada56..c4c013b15725 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -782,6 +782,12 @@ void SmRootNode::Arrange(OutputDevice &rDev, const
SmFormat &rFormat)
nHeight += rFormat.GetDistance(DIS_ROOT)
* GetFont().GetFontSize().Height() / 100;
+ if (nHeight < 0)
+ {
+ SAL_WARN("starmath", "negative height");
+ nHeight = 0;
+ }
+
// font specialist advised to change the width first
pRootSym->AdaptToY(rDev, nHeight);
pRootSym->AdaptToX(rDev, pBody->GetItalicWidth());