From 9e60b45997d74955e5b997d58a1cb357f27d4407 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 18 Sep 2017 21:17:32 +0100 Subject: tdf#112399 ignore size of unknown/unused ole2 entries Change-Id: I9908453c1a11997141f7d6c4e1dccff53984321c Reviewed-on: https://gerrit.libreoffice.org/42438 Tested-by: Jenkins Reviewed-by: Michael Stahl --- sot/qa/cppunit/data/fail/fdo41642-2.compound | Bin 35335 -> 0 bytes sot/qa/cppunit/data/pass/fdo41642-2.compound | Bin 0 -> 35335 bytes sot/qa/cppunit/data/pass/tdf112399-1.compound | Bin 0 -> 103427 bytes sot/source/sdstor/stgelem.cxx | 12 ++++++++++++ 4 files changed, 12 insertions(+) delete mode 100644 sot/qa/cppunit/data/fail/fdo41642-2.compound create mode 100644 sot/qa/cppunit/data/pass/fdo41642-2.compound create mode 100644 sot/qa/cppunit/data/pass/tdf112399-1.compound (limited to 'sot') diff --git a/sot/qa/cppunit/data/fail/fdo41642-2.compound b/sot/qa/cppunit/data/fail/fdo41642-2.compound deleted file mode 100644 index b1ae6dd63046..000000000000 Binary files a/sot/qa/cppunit/data/fail/fdo41642-2.compound and /dev/null differ diff --git a/sot/qa/cppunit/data/pass/fdo41642-2.compound b/sot/qa/cppunit/data/pass/fdo41642-2.compound new file mode 100644 index 000000000000..b1ae6dd63046 Binary files /dev/null and b/sot/qa/cppunit/data/pass/fdo41642-2.compound differ diff --git a/sot/qa/cppunit/data/pass/tdf112399-1.compound b/sot/qa/cppunit/data/pass/tdf112399-1.compound new file mode 100644 index 000000000000..d3628def0c01 Binary files /dev/null and b/sot/qa/cppunit/data/pass/tdf112399-1.compound differ diff --git a/sot/source/sdstor/stgelem.cxx b/sot/source/sdstor/stgelem.cxx index 0fb80c4a36cc..c44d15849259 100644 --- a/sot/source/sdstor/stgelem.cxx +++ b/sot/source/sdstor/stgelem.cxx @@ -424,6 +424,18 @@ bool StgEntry::Load(const void* pFrom, sal_uInt32 nBufSize, sal_uInt64 nUnderlyi //bad pageid return false; } + if (m_cType == STG_EMPTY) + { + /* + tdf#112399 opens fine in MSOffice 2013 despite a massive m_nSize field + + Free (unused) directory entries are marked with Object Type 0x0 + (unknown or unallocated). The entire directory entry must consist of + all zeroes except for the child, right sibling, and left sibling + pointers, which must be initialized to NOSTREAM (0xFFFFFFFF). + */ + m_nSize = 0; + } if (m_nSize < 0) { // the size makes no sense for the substorage -- cgit