[Libreoffice-commits] core.git: Branch 'libreoffice-7-0-5' - sw/qa sw/source

Justin Luth (via logerrit) logerrit at kemper.freedesktop.org
Thu Feb 25 11:35:33 UTC 2021


 sw/qa/extras/ooxmlexport/data/tdf140572_docDefault_superscript.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport16.cxx                          |    5 +++++
 sw/source/filter/ww8/docxattributeoutput.cxx                        |    2 +-
 3 files changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 24ad70e40191c3f04ab96fc97e6cd80706ee7e31
Author:     Justin Luth <justin_luth at sil.org>
AuthorDate: Tue Feb 23 15:22:47 2021 +0200
Commit:     Adolfo Jayme Barrientos <fitojb at ubuntu.com>
CommitDate: Thu Feb 25 12:34:57 2021 +0100

    tdf#140572 docx export: avoid DocDefault superscript crash
    
    This fixes a crash situation introduced in LO 6.4
    by commit d71cf6390a89ea6a4fab724e3a7996f28ca33661.
    
    The crash was occurring when the DocDefaults were
    being exported. Since there was no character or
    paragraph context, the lookup of the related
    fontsize was crashing.
    
    Moving this variable closer to where it is used
    "just happens" to fix the crash. Because the
    DocDefault is considered a style, we are just
    exporting the superscript/subscript as a default
    size, and so don't need to know the font size.
    Thus a style-context position can't cause the
    crash again.
    
    So it isn't a great fix, and leaves the possibility
    for the same thing to happen in other situations
    (like RES_CHRATR_BACKGROUND), but at least it
    quickly solves this known problem, and is easily
    backportable, as well as following best practice
    of keeping variables as close to where they are
    used as possible - eliminating some unnecessary
    lookups.
    
    I did look for a more generic fix (or whether
    other properties could be affected) and didn't
    come with any clear examples or a better fix.
    
    Change-Id: I03dc3d74a5148973c065cadb09c5c79068f12df1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111403
    Tested-by: Jenkins
    Tested-by: Justin Luth <justin_luth at sil.org>
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    (cherry picked from commit 76d2a9fd461dde817fbb1c5d4aa830cb2c42b504)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111458
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
    (cherry picked from commit 2f26a9c9242b8443f0fb987822404027053a98ff)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111461
    Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
    Tested-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf140572_docDefault_superscript.docx b/sw/qa/extras/ooxmlexport/data/tdf140572_docDefault_superscript.docx
new file mode 100755
index 000000000000..fd176dc8c896
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf140572_docDefault_superscript.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
index c2d17d965781..c300f7068110 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
@@ -48,6 +48,11 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFooterMarginLost, "footer-margin-lost.do
     assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:pgMar", "footer", "709");
 }
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf140572_docDefault_superscript, "tdf140572_docDefault_superscript.docx")
+{
+    // A round-trip was crashing.
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf138953, "croppedAndRotated.odt")
 {
     CPPUNIT_ASSERT_EQUAL(1, getShapes());
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 4f8773bef97b..018a00c27392 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -7253,9 +7253,9 @@ void DocxAttributeOutput::CharEscapement( const SvxEscapementItem& rEscapement )
     if ( !sIss.isEmpty() )
         m_pSerializer->singleElementNS(XML_w, XML_vertAlign, FSNS(XML_w, XML_val), sIss);
 
-    const SvxFontHeightItem& rItem = m_rExport.GetItem(RES_CHRATR_FONTSIZE);
     if (sIss.isEmpty() || sIss.match("baseline"))
     {
+        const SvxFontHeightItem& rItem = m_rExport.GetItem(RES_CHRATR_FONTSIZE);
         float fHeight = rItem.GetHeight();
         OString sPos = OString::number( round(( fHeight * nEsc ) / 1000) );
         m_pSerializer->singleElementNS(XML_w, XML_position, FSNS(XML_w, XML_val), sPos);


More information about the Libreoffice-commits mailing list