sw/source/filter/ww8/docxattributeoutput.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
New commits: commit 7952978822858fedb580a4564f190223d767d6af Author: Noel Grandin <[email protected]> AuthorDate: Fri Oct 31 16:09:17 2025 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Mon Nov 3 20:34:53 2025 +0100 mso-test: clamp a:cx and a:cy to >= 0 When loading and then saving the document from ooo83929-3.doc, we end up with negative values here, which is not valid. Use our existing mechanism to enforce correct ordering. Change-Id: Id584e0bd1d2a2bfcca84b19517f426b0b7c5f510 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193324 Reviewed-by: Miklos Vajna <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> (cherry picked from commit ff30cc6a366f1cbaa4f038542d78842cbc90b039) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193362 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 9a8910d504de..a9c5fad5f806 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -5592,8 +5592,9 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size m_pSerializer->startElementNS(XML_a, XML_xfrm, xFrameAttributes); m_pSerializer->singleElementNS(XML_a, XML_off, XML_x, "0", XML_y, "0"); - OString aWidth( OString::number( TwipsToEMU( aSize.Width() ) ) ); - OString aHeight( OString::number( TwipsToEMU( aSize.Height() ) ) ); + // clamp to >=0, negative values are not valid here + OString aWidth( OString::number( std::max(sal_Int64(0), TwipsToEMU( aSize.Width() )) ) ); + OString aHeight( OString::number( std::max(sal_Int64(0), TwipsToEMU( aSize.Height() )) ) ); m_pSerializer->singleElementNS(XML_a, XML_ext, XML_cx, aWidth, XML_cy, aHeight); m_pSerializer->endElementNS( XML_a, XML_xfrm ); m_pSerializer->startElementNS(XML_a, XML_prstGeom, XML_prst, "rect");
