editeng/source/rtf/rtfitem.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
New commits: commit 8323008a38bf23a0a5f04377bdf3ddaaf471117a Author: Jonathan Clark <[email protected]> AuthorDate: Tue Sep 16 14:21:34 2025 -0600 Commit: Xisco Fauli <[email protected]> CommitDate: Thu Sep 18 08:48:54 2025 +0200 tdf#168424 editeng: Fix unsafe s/uint implicit cast in RTF parser The editeng RTF parser was round-tripping signed integers through a sal_uInt16 via implicit casts when populating SvxLRSpaceItem. This worked because such an implicit cast may convert signed numbers into their unsigned two's complement representation, and vice-versa. Unfortunately, a recent change to SvxLRSpaceItem replaced the final implicit uint-to-sint cast with an implicit uint-to-double one, which does not have the same properties. Change-Id: I80b1a36c47323309b33a8ddaee652c238a7530f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191052 Tested-by: Jenkins Reviewed-by: Jonathan Clark <[email protected]> (cherry picked from commit c93d70db199cc7f89490cf9f34aa43ea67892c52) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191101 Reviewed-by: Xisco Fauli <[email protected]> diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx index 17aafa8a558e..b8c89be01029 100644 --- a/editeng/source/rtf/rtfitem.cxx +++ b/editeng/source/rtf/rtfitem.cxx @@ -318,12 +318,12 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) if (const TypedWhichId<SvxLRSpaceItem> wid = aPardMap[SID_ATTR_LRSPACE]) { SvxLRSpaceItem aLR(pSet->Get(wid)); - sal_uInt16 nSz = 0; + sal_Int16 nSz = 0; if( -1 != nTokenValue ) { if( IsCalcValue() ) CalcValue(); - nSz = sal_uInt16(nTokenValue); + nSz = sal_Int16(nTokenValue); } aLR.SetTextFirstLineOffset(SvxIndentValue::twips(nSz)); pSet->Put( aLR ); @@ -335,12 +335,12 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) if (const TypedWhichId<SvxLRSpaceItem> wid = aPardMap[SID_ATTR_LRSPACE]) { SvxLRSpaceItem aLR(pSet->Get(wid)); - sal_uInt16 nSz = 0; + sal_Int16 nSz = 0; if( 0 < nTokenValue ) { if( IsCalcValue() ) CalcValue(); - nSz = sal_uInt16(nTokenValue); + nSz = sal_Int16(nTokenValue); } aLR.SetTextLeft(SvxIndentValue::twips(nSz)); pSet->Put( aLR ); @@ -352,12 +352,12 @@ void SvxRTFParser::ReadAttr( int nToken, SfxItemSet* pSet ) if (const TypedWhichId<SvxLRSpaceItem> wid = aPardMap[SID_ATTR_LRSPACE]) { SvxLRSpaceItem aLR(pSet->Get(wid)); - sal_uInt16 nSz = 0; + sal_Int16 nSz = 0; if( 0 < nTokenValue ) { if( IsCalcValue() ) CalcValue(); - nSz = sal_uInt16(nTokenValue); + nSz = sal_Int16(nTokenValue); } aLR.SetRight(SvxIndentValue::twips(nSz)); pSet->Put( aLR );
