3.6.0 regression: non-deterministic filter selection ...

Kohei Yoshida kohei.yoshida at gmail.com
Wed Aug 15 10:00:39 PDT 2012


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.

IMO, it's safe to drop this check since it doesn't do anything 
significant anyway, and it obviously prevents legitimate Word files from 
being loaded.

Any opinions?

Kohei

-- 
Kohei Yoshida, LibreOffice hacker, Calc


More information about the LibreOffice mailing list