[Libreoffice-commits] core.git: starmath/source

Caolán McNamara caolanm at redhat.com
Tue Dec 19 09:16:35 UTC 2017


 starmath/source/mathmlattr.cxx |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

New commits:
commit 6e3f0fbb95f004e125837ef2ecb216f370e59756
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Dec 18 13:29:29 2017 +0000

    ofz: recognize invalid and negative fractions
    
    Change-Id: Ie00a608a60a35bf333d63be54f21085ecf44347b
    Reviewed-on: https://gerrit.libreoffice.org/46725
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/starmath/source/mathmlattr.cxx b/starmath/source/mathmlattr.cxx
index 74e32d42944b..344c079b35e9 100644
--- a/starmath/source/mathmlattr.cxx
+++ b/starmath/source/mathmlattr.cxx
@@ -44,14 +44,11 @@ sal_Int32 ParseMathMLNumber(const OUString &rStr, Fraction& rN)
         return -1;
     bool bNegative = (rStr[0] == '-');
     sal_Int32 nOffset = bNegative ? 1 : 0;
-    Fraction aF;
-    auto nIdx = ParseMathMLUnsignedNumber(rStr.copy(nOffset), aF);
-    if (nIdx <= 0)
+    auto nIdx = ParseMathMLUnsignedNumber(rStr.copy(nOffset), rN);
+    if (nIdx <= 0 || !rN.IsValid())
         return -1;
     if (bNegative)
-        rN = Fraction(aF.GetNumerator(), aF.GetDenominator());
-    else
-        rN = aF;
+        rN *= -1;
     return nOffset + nIdx;
 }
 


More information about the Libreoffice-commits mailing list