summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-03-04 08:55:14 +0100
committerStephan Bergmann <sbergman@redhat.com>2019-03-04 13:26:51 +0100
commitf4a55b6bcaaa2d0b7e6162ab735788c35efe096c (patch)
tree9c8ee974b4334002c6e0857c0b02b825d6df57c6
parentdraw polyline and polygon when drawing rect draw command (diff)
downloadcore-f4a55b6bcaaa2d0b7e6162ab735788c35efe096c.tar.gz
core-f4a55b6bcaaa2d0b7e6162ab735788c35efe096c.zip
Avoid intermediate computation overflowing sal_uInt16
At least during CppunitTest_sw_uwriter, some m_nStrResId is read so that Clang's -fsanitize=implicit-signed-integer-truncation warned that an "implicit conversion from type 'int' of value 74752 (32-bit, signed) to type 'sal_uInt16' (aka 'unsigned short') changed the value to 9216 (16-bit, unsigned)". Change-Id: I39f12d931bb18eea909494c8d7c9c0348fb71f27 Reviewed-on: https://gerrit.libreoffice.org/68664 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r--sw/source/core/doc/tblafmt.cxx6
1 files changed, 2 insertions, 4 deletions
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index 6fe546fc32b5..fbf6270bdd8c 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -981,11 +981,9 @@ bool SwTableAutoFormat::Load( SvStream& rStream, const SwAfVersions& rVersions )
{
rStream.ReadUInt16( m_nStrResId );
// start from 3d because default is added via constructor
- sal_uInt16 nId = RES_POOLTABLESTYLE_3D + m_nStrResId;
- if( RES_POOLTABLESTYLE_3D <= nId &&
- nId < RES_POOLTABSTYLE_END )
+ if( m_nStrResId < RES_POOLTABSTYLE_END - RES_POOLTABLESTYLE_3D )
{
- m_aName = SwStyleNameMapper::GetUIName(nId, m_aName);
+ m_aName = SwStyleNameMapper::GetUIName(RES_POOLTABLESTYLE_3D + m_nStrResId, m_aName);
}
else
m_nStrResId = USHRT_MAX;