[Libreoffice-commits] core.git: sw/qa sw/source

Rajashri rajashri.udhoji at synerzip.com
Fri Mar 21 10:27:40 PDT 2014


 sw/qa/extras/ooxmlexport/data/TCTagMisMatch.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx         |   12 ++++++++++++
 sw/source/filter/ww8/docxattributeoutput.cxx     |   13 +++++++++----
 3 files changed, 21 insertions(+), 4 deletions(-)

New commits:
commit 5ff0e274bb146bbaede31e9e349cba301137d4f2
Author: Rajashri <rajashri.udhoji at synerzip.com>
Date:   Thu Mar 20 13:27:17 2014 +0530

    fdo#76361 : LO crash: LO crashes while saving the document to docx
    
    The document contains an empty table with borders.
    LO was treating this table as a nested table, which lead to
    a TC tag mismatch.
    In docxattributeoutput.cxx, inside 'switchHeaderFooter'
    added a check against 'm_oldTableReference->m_pOldTablepInner'
    For some documents, even if the above value was null, still
    it was getting assigned to 'm_tableReference' . Thus in such situations
    it leads to a crash.
    
    Change-Id: I883267585cb804f961989797de57c4b843b96821
    Reviewed-on: https://gerrit.libreoffice.org/8677
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/qa/extras/ooxmlexport/data/TCTagMisMatch.docx b/sw/qa/extras/ooxmlexport/data/TCTagMisMatch.docx
new file mode 100644
index 0000000..6d890ac
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/TCTagMisMatch.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index a1542d9..966e52c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2887,6 +2887,18 @@ DECLARE_OOXMLEXPORT_TEST(test76108, "test76108.docx")
     assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[1]/w:fldChar[1]", "fldCharType", "begin");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTCTagMisMatch, "TCTagMisMatch.docx")
+{
+   // TCTagMisMatch.docx : This document contains a empty table with borders.
+   // there was a TC tag mismatch which resulted into a crash.
+
+   xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+   if(!pXmlDoc)
+      return;
+   assertXPath(pXmlDoc,"/w:document[1]/w:body[1]/w:tbl[1]/w:tr[1]/w:tc[1]/w:tbl[1]/w:tr[1]/w:tc[1]",0);
+   assertXPath(pXmlDoc,"/w:document[1]/w:body[1]/w:tbl[1]/w:tr[1]/w:tc[1]", 1);
+}
+
 DECLARE_OOXMLEXPORT_TEST(testHyperLinkTagEnded, "fdo76316.docx")
 {
     /* XML tag <w:hyperlink> was not getting closed when its inside another
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index a088367..e287f71 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2489,10 +2489,15 @@ void DocxAttributeOutput::switchHeaderFooter(bool isHeaderFooter, sal_Int32 inde
     }
     else if( index == -1)
     {
-        *m_tableReference = *m_oldTableReference;
-        //Reset the oldReference, after copying it back to the original.
-        m_oldTableReference->m_bTableCellOpen = false ;
-        m_oldTableReference->m_nTableDepth = 0;
+       if (m_oldTableReference->m_pOldTablepInner)
+       {
+           *m_tableReference = *m_oldTableReference;
+
+            //Reset the oldReference, after copying it back to the original.
+            m_oldTableReference->m_bTableCellOpen = false ;
+            m_oldTableReference->m_nTableDepth = 0;
+       }
+
     }
     else
     {


More information about the Libreoffice-commits mailing list