From 5ff0e274bb146bbaede31e9e349cba301137d4f2 Mon Sep 17 00:00:00 2001 From: Rajashri Date: Thu, 20 Mar 2014 13:27:17 +0530 Subject: 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 Tested-by: Miklos Vajna --- sw/qa/extras/ooxmlexport/data/TCTagMisMatch.docx | Bin 0 -> 16327 bytes sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 12 ++++++++++++ 2 files changed, 12 insertions(+) create mode 100644 sw/qa/extras/ooxmlexport/data/TCTagMisMatch.docx (limited to 'sw/qa/extras') 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 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 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 was not getting closed when its inside another -- cgit