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>
This commit is contained in:
@@ -981,11 +981,9 @@ bool SwTableAutoFormat::Load( SvStream& rStream, const SwAfVersions& rVersions )
|
|||||||
{
|
{
|
||||||
rStream.ReadUInt16( m_nStrResId );
|
rStream.ReadUInt16( m_nStrResId );
|
||||||
// start from 3d because default is added via constructor
|
// start from 3d because default is added via constructor
|
||||||
sal_uInt16 nId = RES_POOLTABLESTYLE_3D + m_nStrResId;
|
if( m_nStrResId < RES_POOLTABSTYLE_END - RES_POOLTABLESTYLE_3D )
|
||||||
if( RES_POOLTABLESTYLE_3D <= nId &&
|
|
||||||
nId < RES_POOLTABSTYLE_END )
|
|
||||||
{
|
{
|
||||||
m_aName = SwStyleNameMapper::GetUIName(nId, m_aName);
|
m_aName = SwStyleNameMapper::GetUIName(RES_POOLTABLESTYLE_3D + m_nStrResId, m_aName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_nStrResId = USHRT_MAX;
|
m_nStrResId = USHRT_MAX;
|
||||||
|
Reference in New Issue
Block a user