[Libreoffice-commits] core.git: sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Mar 4 12:27:14 UTC 2019
sw/source/core/doc/tblafmt.cxx | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
New commits:
commit f4a55b6bcaaa2d0b7e6162ab735788c35efe096c
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon Mar 4 08:55:14 2019 +0100
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Mon Mar 4 13:26:51 2019 +0100
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 at redhat.com>
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;
More information about the Libreoffice-commits
mailing list