summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorPallavi Jadhav <pallavi.jadhav@synerzip.com>2014-05-12 15:33:08 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-05-16 11:03:37 +0200
commita05e5016287fdf06378e8b854a40db32d2da7204 (patch)
treefd573899ef06f4f5828c9accbf5b0a0eabf2a704 /sw/qa
parent5a9399a62873dae10e6486e8a6764b163283c0e1 (diff)
fdo#78432 : DOCX: File gets corrupt after RoundTrip
Issue : - In RT in document.xml, value of Absolute Position Offset <wp:posOffset> was going out of bounds. - <wp:posOffset> is of type Int(32-bits), hence it's value should not cross the MAX and MIN limits of Int. Implementation : - Added check for <wp:posOffset> should not cross Maximum/Minimum limit of Int. - Written Export Unit test case. Reviewed on: https://gerrit.libreoffice.org/9328 Change-Id: I22e75d7e603ebbf6a49e764fb1a3e6a4d2fd8b23
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/ooxmlexport/data/fdo78432.docxbin0 -> 29365 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx27
2 files changed, 27 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/fdo78432.docx b/sw/qa/extras/ooxmlexport/data/fdo78432.docx
new file mode 100644
index 000000000000..343e76ae25f4
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/fdo78432.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index cb89ac346d2d..014c3b9d12a2 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3310,6 +3310,33 @@ DECLARE_OOXMLEXPORT_TEST(testPageBreakInFirstPara,"fdo77727.docx")
assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[2]/w:br","type","page");
}
+DECLARE_OOXMLEXPORT_TEST(testAbsolutePositionOffsetValue,"fdo78432.docx")
+{
+ xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ if (!pXmlDoc)
+ return;
+
+ sal_Int32 IntMax = 2147483647;
+
+ xmlNodeSetPtr pXmlNodes[6];
+ pXmlNodes[0] = getXPathNode(pXmlDoc,"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionH[1]/wp:posOffset[1]");
+ pXmlNodes[1] = getXPathNode(pXmlDoc,"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionV[1]/wp:posOffset[1]");
+
+ pXmlNodes[2] = getXPathNode(pXmlDoc,"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[2]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionH[1]/wp:posOffset[1]");
+ pXmlNodes[3] = getXPathNode(pXmlDoc,"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[2]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionV[1]/wp:posOffset[1]");
+
+ pXmlNodes[4] = getXPathNode(pXmlDoc,"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[3]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionH[1]/wp:posOffset[1]");
+ pXmlNodes[5] = getXPathNode(pXmlDoc,"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[3]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionV[1]/wp:posOffset[1]");
+
+ for(sal_Int32 index = 0; index<6; ++index)
+ {
+ CPPUNIT_ASSERT(pXmlNodes[index] != 0);
+ xmlNodePtr pXmlNode = pXmlNodes[index]->nodeTab[0];
+ OUString contents = OUString::createFromAscii((const char*)((pXmlNode->children[0]).content));
+ CPPUNIT_ASSERT( contents.toInt64() <= IntMax );
+ }
+}
+
DECLARE_OOXMLEXPORT_TEST(testFDO78284, "fdo78284.docx")
{
xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml");