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

Stephan Bergmann sbergman at redhat.com
Tue Aug 26 09:19:54 PDT 2014


 sw/source/filter/ww8/wrtw8esh.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 7c82d8a5c7595ae19e662ae4d64527512828451b
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Aug 26 18:19:13 2014 +0200

    Avoid undefined left shift of negative value
    
    Change-Id: I8678215526990158215544c17aa9cf3aa178da01

diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index dd9effc..d9f5d6c 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -2170,7 +2170,7 @@ sal_Int32 SwBasicEscherEx::ToFract16(sal_Int32 nVal, sal_uInt32 nMax) const
             // negative fraction does not have "-0", fractional part is always
             // positive:  -0.4 represented as -1 + 0.6
             sal_Int32 const nDiv = (nVal / sal_Int32(nMax)) - 1;
-            sal_uInt32 nMSVal = (nDiv << 16) & 0xffff0000;
+            sal_uInt32 nMSVal = (sal_uInt32(nDiv) << 16) & 0xffff0000;
             nMSVal += (nVal * 65536) / sal_Int32(nMax) + (-nDiv * 65536);
             return nMSVal;
         }


More information about the Libreoffice-commits mailing list