Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


Hi Kohei,

On 15.08.2012 21:00, Kohei Yoshida wrote:
On 08/15/2012 12:26 PM, Kohei Yoshida wrote:
On 08/15/2012 12:12 PM, Kohei Yoshida wrote:
Ah.  Now I know.  Ultimately the failure is due to StgHeader::Check()
returning false on Large-Word.doc.

http://opengrok.libreoffice.org/xref/core/sot/source/sdstor/stgelem.cxx#186



Changing this method to always return true leads to Writer loading the
file correctly.

And the check that fails is this:

( nMasterChain == -2 || ( nMasterChain >=0 && nMaster > 109 ) )

where nMasterChain == 24269 and nMaster == 2.  Since nMaster > 109 is
false, it returns false, and the whole thing starts to crumble...

So, we have a choice to make.  This patch

diff --git a/sot/source/sdstor/stgelem.cxx b/sot/source/sdstor/stgelem.cxx
index 5fb3a09..dfcc28a 100644
--- a/sot/source/sdstor/stgelem.cxx
+++ b/sot/source/sdstor/stgelem.cxx
@@ -194,7 +194,7 @@ sal_Bool StgHeader::Check()
              && nTOCstrm >= 0
              && nThreshold > 0
              && ( nDataFAT == -2 || ( nDataFAT >= 0 && nDataFATSize > 0
) )
-            && ( nMasterChain == -2 || ( nMasterChain >=0 && nMaster >
109 ) )
+            && ( nMasterChain == -2 || nMasterChain >=0 )
              && nMaster >= 0;
  }

which removes the check for nMaster being greater than 109 fixes this
load issue.

The documentation:

http://msdn.microsoft.com/en-us/library/dd941946%28v=prot.13%29

basically says that number represents the number of DIFAT sectors that
follows, and the number of the DIFAT sectors is always 109.  That's
probably where the check came from (though strictly the check should be
nMaster == 109 instead of nMaster > 109).

But we always load 109 DIFAT sectors regardless of the value of nMaster,
and nMaster *may* actually represents the number of *used* DIFAT
sectors... Who knows?  The documentation is not very clear about this.

first 109 sectors are in the header anyway and nMaster are in FAT (if needed). nMaster should not be checked for 109.

http://msdn.microsoft.com/en-us/library/dd941958%28v=prot.13%29

Best regards,
Ivan

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.