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

Stephan Bergmann sbergman at redhat.com
Thu Oct 23 06:35:08 PDT 2014


 sc/source/filter/excel/excrecds.cxx |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 644678e2accb3d06b541e91001682a7c1faedcaa
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Oct 23 15:34:41 2014 +0200

    Avoid left shift of negative values (ubsan)
    
    Change-Id: If465c155c70ec068b6bd7adc05f188bbecc2824e

diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx
index d911c19..2273c8f 100644
--- a/sc/source/filter/excel/excrecds.cxx
+++ b/sc/source/filter/excel/excrecds.cxx
@@ -469,13 +469,13 @@ void XclExpSheetProtection::SaveXml( XclExpXmlStream& rStrm )
    if ( pTabProtect )
    {
         Sequence<sal_Int8> aHash = pTabProtect->getPasswordHash(PASSHASH_XL);
-        sal_uInt16 nHash(0x0000);
         OString sHash;
         if (aHash.getLength() >= 2)
         {
-            nHash = ((aHash[0] << 8) & 0xFFFF);
-            nHash |= (aHash[1] & 0xFF);
-            sHash = OString::number( nHash, 16 );
+            sHash = OString::number(
+                ( static_cast<sal_uInt8>(aHash[0]) << 8
+                  | static_cast<sal_uInt8>(aHash[1]) ),
+                16 );
         }
         sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
         rWorksheet->singleElement( XML_sheetProtection,


More information about the Libreoffice-commits mailing list