Kaydet (Commit) dfc2e9be authored tarafından Caolán McNamara's avatar Caolán McNamara

ofz#7012 Integer-overflow

and fix negative rounding code, which results in changing tet
of from -996 to -1002 which is closer to the original -1000

Change-Id: Ie992e61bf4d14d0cd4194e773479feba96b6d68e
Reviewed-on: https://gerrit.libreoffice.org/51576Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 2dadf90a
......@@ -90,14 +90,18 @@ float GetTextSize( const OUString& sValue )
sal_Int32 GetTextSpacingPoint( const OUString& sValue )
{
sal_Int32 nRet;
if( ::sax::Converter::convertNumber( nRet, sValue ) )
if( ::sax::Converter::convertNumber( nRet, sValue, (SAL_MIN_INT32 + 360) / 254, (SAL_MAX_INT32 - 360) / 254 ) )
nRet = GetTextSpacingPoint( nRet );
return nRet;
}
sal_Int32 GetTextSpacingPoint( const sal_Int32 nValue )
sal_Int32 GetTextSpacingPoint(sal_Int32 nValue)
{
return ( nValue * 254 + 360 ) / 720;
if (nValue > 0)
nValue = (nValue * 254 + 360);
else if (nValue < 0)
nValue = (nValue * 254 - 360);
return nValue / 720;
}
float GetFontHeight( sal_Int32 nHeight )
......
......@@ -3415,8 +3415,8 @@ void ScExportTest::testSheetCondensedCharacterSpaceXLSX()
OUString CondensedCharSpace = getXPath(pDoc,
"/xdr:wsDr[1]/xdr:twoCellAnchor[1]/xdr:sp[1]/xdr:txBody[1]/a:p[1]/a:r[1]/a:rPr[1]","spc");
// make sure that the CondensedCharSpace is -996.
CPPUNIT_ASSERT_EQUAL(OUString("-996"), CondensedCharSpace);
// make sure that the CondensedCharSpace is -1002.
CPPUNIT_ASSERT_EQUAL(OUString("-1002"), CondensedCharSpace);
xDocSh->DoClose();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment