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

Caolán McNamara caolanm at redhat.com
Mon Oct 30 14:21:58 UTC 2017


 filter/source/graphicfilter/ios2met/ios2met.cxx |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit a4fbe0c5922392341aa48c8d6d8be72e1abf0abf
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Oct 30 10:21:52 2017 +0000

    ofz#3901 Integer-overflow
    
    Change-Id: Iebb9c82aea61a255b1a5ef4d9f1b66bc0fb17c59
    Reviewed-on: https://gerrit.libreoffice.org/44053
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/filter/source/graphicfilter/ios2met/ios2met.cxx b/filter/source/graphicfilter/ios2met/ios2met.cxx
index 9e12e1b1f801..43887ace6d58 100644
--- a/filter/source/graphicfilter/ios2met/ios2met.cxx
+++ b/filter/source/graphicfilter/ios2met/ios2met.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <osl/thread.h>
+#include <o3tl/safeint.hxx>
 #include <tools/poly.hxx>
 #include <tools/fract.hxx>
 #include <vcl/graph.hxx>
@@ -1149,7 +1150,6 @@ void OS2METReader::ReadPartialArc(bool bGivenPos, sal_uInt16 nOrderSize)
     Point aP0, aCenter,aPStart,aPEnd;
     sal_Int32 nP,nQ,nStart, nSweep;
     tools::Rectangle aRect;
-    sal_uInt32 nMul; sal_uInt16 nMulS;
     double fStart, fEnd;
 
     if (bGivenPos) {
@@ -1160,8 +1160,11 @@ void OS2METReader::ReadPartialArc(bool bGivenPos, sal_uInt16 nOrderSize)
     aCenter=ReadPoint();
 
     nP=aAttr.nArcP; nQ=aAttr.nArcQ;
-    if (nP<0) nP=-nP;
-    if (nQ<0) nQ=-nQ;
+    if (nP < 0)
+        nP = o3tl::saturating_toggle_sign(nP);
+    if (nQ < 0)
+        nQ = o3tl::saturating_toggle_sign(nQ);
+    sal_uInt32 nMul(0); sal_uInt16 nMulS(0);
     if (nOrderSize>=12) pOS2MET->ReadUInt32( nMul );
     else { pOS2MET->ReadUInt16( nMulS ); nMul=((sal_uInt32)nMulS)<<8; }
     if (nMul!=0x00010000) {


More information about the Libreoffice-commits mailing list