summaryrefslogtreecommitdiff
path: root/sc/source/filter/excel
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-10-23 15:34:41 +0200
committerStephan Bergmann <sbergman@redhat.com>2014-10-23 15:34:41 +0200
commit644678e2accb3d06b541e91001682a7c1faedcaa (patch)
tree0107d5c3cd100ee08ebde3ec8b8174e0ea1782a8 /sc/source/filter/excel
parent413210a5036486dc1777565c3c69b2eda68b3f93 (diff)
Avoid left shift of negative values (ubsan)
Change-Id: If465c155c70ec068b6bd7adc05f188bbecc2824e
Diffstat (limited to 'sc/source/filter/excel')
-rw-r--r--sc/source/filter/excel/excrecds.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx
index d911c1901544..2273c8f97958 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,