Bug Hunting Session
Bug 41554 - FILEOPEN WinWord6 file cannot be opened
Summary: FILEOPEN WinWord6 file cannot be opened
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
3.4.3 release
Hardware: Other All
: medium normal
Assignee: Caolán McNamara
URL:
Whiteboard: target:4.0.0
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-07 05:32 UTC by Andras Timar
Modified: 2012-11-29 09:23 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
WinWord6 file (114.50 KB, application/msword)
2011-10-07 05:32 UTC, Andras Timar
Details
typescript with backtrace full from display of the msgbox (46.36 KB, text/plain)
2012-09-15 21:58 UTC, Terrence Enger
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andras Timar 2011-10-07 05:32:53 UTC
Created attachment 52080 [details]
WinWord6 file

When I try to open the attached file...
In LibreOffice 3.3 I have to choose the import filter. When I choose Microsoft Word 6, it says "This is not a WinWord6 file".
In LibreOffice 3.4.3 and in master, it says immediately: "This is not a WinWord97 file".
The file can be opened in MS Word 2003 without problems.
Comment 1 Björn Michaelsen 2011-12-23 12:34:52 UTC
[This is an automated message.]
This bug was filed before the changes to Bugzilla on 2011-10-16. Thus it
started right out as NEW without ever being explicitly confirmed. The bug is
changed to state NEEDINFO for this reason. To move this bug from NEEDINFO back
to NEW please check if the bug still persists with the 3.5.0 beta1 or beta2 prereleases.
Details on how to test the 3.5.0 beta1 can be found at:
http://wiki.documentfoundation.org/QA/BugHunting_Session_3.5.0.-1

more detail on this bulk operation: http://nabble.documentfoundation.org/RFC-Operation-Spamzilla-tp3607474p3607474.html
Comment 2 Roman Eisele 2012-05-04 08:24:04 UTC
This is a Writer issue, therefore changed 'Component' field accordingly.
Comment 3 Roman Eisele 2012-05-04 08:26:34 UTC
Still [REPRODUCIBLE] with LibreOffice 3.5.3.2 (Build-ID: 235ab8a-3802056-4a8fed3-2d66ea8-e241b8), German langpack installed, on MacOS X 10.6.8 German.

If I try to open the file, LibreOffice still just says "This is not a
WinWord97 file".

Changing Status to 'NEW'.
Comment 4 Terrence Enger 2012-09-15 21:58:10 UTC
Created attachment 67215 [details]
typescript with backtrace full from display of the msgbox

I still see the error message with master 741c56a, pulled 2012-09-13
and configured with

    --enable-symbols
    --enable-dbgutil
    --enable-crashdump
    --disable-build-mozilla
    --without-system-postgresql
    --enable-debug
    --enable-werror


Terry.
Comment 5 Julien Nabet 2012-11-24 14:11:33 UTC
It seems that the problem could be located in
sw/source/filter/ww8/ww8toolbar.cxx:846 (function Tcg255::processSubStruct)

When the file is loaded, LO enters in this function first time with parameter nId = 1, then goes to the switch:
    849          case 0x1:
    850          {
    851              pSubStruct = new PlfMcd( false ); // don't read the id
    852              break;
    853          }
Notice the comment 'don't read the id' whereas some lines after the switch, we have:
    884     pSubStruct->ch = nId;
    885     if ( !pSubStruct->Read( rS ) )
    886         return false;

Since we don't return from this function like in "default" case, it fails at pSubStruct->Read, see:
885	    if ( !pSubStruct->Read( rS ) )
(gdb) s
PlfMcd::Read (this=0x5d3d870, rS=...) at /home/julien/compile-libreoffice/libo/sw/source/filter/ww8/ww8toolbar.cxx:970
970	    OSL_TRACE("PffMcd::Read() stream pos 0x%x", rS.Tell() );
(gdb) n
[Thread 0x7f995d8b2700 (LWP 23551) exited]
971	    nOffSet = rS.Tell();
(gdb) n
972	    Tcg255SubStruct::Read( rS );
(gdb) n
973	    rS >> iMac;
(gdb) n
974	    if ( iMac )
(gdb) p iMac
$30 = -430637046
(gdb) n
976	        rgmcd = new MCD[ iMac ];
(gdb) p iMac
$31 = -430637046
(gdb) n

So I dynamically change nId value in order to go in "default" case and was able to open the file.

So, perhaps an easy fix could be to add a "return false" in case 1 instead of break. Of course it's only a guess instead of a real understanding :-( 

Stephan/Caolán/Cedric: would one of you have some time to take a look to this?
Comment 6 Caolán McNamara 2012-11-28 15:33:13 UTC
assuming that's the problem my instincts would be to simply not parse that blob in the WW6 case seeing as its probably not exactly the same format as the WW8 case.

caolanm->noelp: Do you have any examples of a ww8 .doc file which has a custom toolbar which should work for comparison purposes ? (and how do I see where does the custom toolbar stuff ends up ?)
Comment 7 Noel Power 2012-11-28 16:14:14 UTC
(In reply to comment #6)
> assuming that's the problem my instincts would be to simply not parse that
> blob in the WW6 case seeing as its probably not exactly the same format as
> the WW8 case.
yup would be the first step I would take ( not sure about detecting the non-ww8 format but presumably done elsewhere )
> 
> caolanm->noelp: Do you have any examples of a ww8 .doc file which has a
> custom toolbar which should work for comparison purposes ? (and how do I see
> where does the custom toolbar stuff ends up ?)

yeah, sent you privately an example ( sorry not to attach it here but it is from a customer document ) I guess it's possibly to create own custom toolbar stuff in a document ( but it's so long since I looked at that stuff I can't even recall how to do it )
Comment 8 Not Assigned 2012-11-28 21:49:26 UTC
Caolan McNamara committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=b2be75d95899a3babc16b2a590f8568cfca8124f

Resolves: fdo#41554 ww6 file cannot be opened



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 9 Noel Power 2012-11-29 09:23:42 UTC
(In reply to comment #8)
> Caolan McNamara committed a patch related to this issue.
> It has been pushed to "master":
> 
> http://cgit.freedesktop.org/libreoffice/core/commit/
> ?id=b2be75d95899a3babc16b2a590f8568cfca8124f
> 
> Resolves: fdo#41554 ww6 file cannot be opened
>
thanks, I was going to look at it today but you beat me to it. I wouldn't have spotted the need for the additional clean up, or was there some extra coring or something that triggered that? In any case... gratitude !!