summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRajashri <rajashri.udhoji@synerzip.com>2014-03-20 13:27:17 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-03-21 17:27:11 +0000
commit5ff0e274bb146bbaede31e9e349cba301137d4f2 (patch)
treed93b9b8eee9a6c2e8228c0552422c4657560ede3
parent9ae556c626da301f3798c33dc7632c7c891f2a04 (diff)
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@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--sw/qa/extras/ooxmlexport/data/TCTagMisMatch.docxbin0 -> 16327 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx12
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx13
3 files changed, 21 insertions, 4 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/TCTagMisMatch.docx b/sw/qa/extras/ooxmlexport/data/TCTagMisMatch.docx
new file mode 100644
index 000000000000..6d890acdb5d9
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/TCTagMisMatch.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index a1542d93a1a9..966e52cef79e 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 a0883679693b..e287f71c866b 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
{