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

Caolán McNamara caolanm at redhat.com
Tue Jan 16 09:42:38 UTC 2018


 sw/source/filter/html/svxcss1.cxx |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

New commits:
commit c305850c1542761de3ec646de1ad2d4e729ec6d4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 16 09:13:00 2018 +0000

    ofz#5391 Integer-overflow
    
    Change-Id: Ic252a95cf535bc40560d8e772224871f2b944345

diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx
index 53800ef351f2..79151c635062 100644
--- a/sw/source/filter/html/svxcss1.cxx
+++ b/sw/source/filter/html/svxcss1.cxx
@@ -2080,10 +2080,18 @@ static void ParseCSS1_margin_left( const CSS1Expression *pExpr,
         break;
     case CSS1_PIXLENGTH:
         {
-            nLeft = static_cast<long>(pExpr->GetNumber());
-            long nPHeight = 0;
-            SvxCSS1Parser::PixelToTwip( nLeft, nPHeight );
-            bSet = true;
+            double fLeft = pExpr->GetNumber();
+            if (fLeft < SAL_MAX_INT32/2.0 && fLeft > SAL_MIN_INT32/2.0)
+            {
+                nLeft = static_cast<long>(fLeft);
+                long nPHeight = 0;
+                SvxCSS1Parser::PixelToTwip( nLeft, nPHeight );
+                bSet = true;
+            }
+            else
+            {
+                SAL_WARN("sw.html", "out-of-size pxlength: " << fLeft);
+            }
         }
         break;
     case CSS1_PERCENTAGE:


More information about the Libreoffice-commits mailing list