Kaydet (Commit) 5ff0e274 authored tarafından Rajashri's avatar Rajashri Kaydeden (comit) Miklos Vajna

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/8677Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst 9ae556c6
......@@ -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
......
......@@ -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
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment