Issue 121977 - crash on doc file opening
Summary: crash on doc file opening
Status: CLOSED FIXED
Alias: None
Product: Writer
Classification: Application
Component: open-import (show other issues)
Version: 3.4.1
Hardware: PC Windows, all
: P3 Normal (vote)
Target Milestone: 4.0.0
Assignee: Oliver-Rainer Wittmann
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-29 19:57 UTC by charly.hamy
Modified: 2017-05-20 11:42 UTC (History)
9 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---
jsc: 4.0.0_release_blocker+


Attachments
file causing the crash (13.00 KB, application/msword)
2013-03-29 19:57 UTC, charly.hamy
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description charly.hamy 2013-03-29 19:57:16 UTC
Created attachment 80479 [details]
file causing the crash

When opening the file in attachment under Windows 8, Writer crashes (receovery dialog is displayed).
Comment 1 DanielAlvaro 2013-04-13 17:32:52 UTC
Reproduced in WIN 8, I have the same error, but I  could opened in  Microsoft Office I  saw it's only for reading not to edit it.
Comment 2 Andre 2013-06-18 09:45:57 UTC
I can reproduce this crash on Windows 7 64 bit (changing platform to Windows, all).

Here is the interesting part of the stack trace:
>	msword.dll!SwWW8ImplReader::SetDocumentGrid(SwFrmFmt & rFmt, const wwSection & rSection)  Line 309 + 0x4 bytes	C++
 	msword.dll!wwSectionManager::SetSegmentToPageDesc(const wwSection & rSection, bool bTitlePage, bool bIgnoreCols)  Line 3850	C++
 	msword.dll!wwSectionManager::SetSwFmtPageDesc(std::_Deque_iterator<wwSection,std::allocator<wwSection>,1> & rIter, std::_Deque_iterator<wwSection,std::allocator<wwSection>,1> & rStart, bool bIgnoreCols)  Line 3952	C++
 	msword.dll!wwSectionManager::InsertSegments()  Line 4060 + 0x1c bytes	C++
 	msword.dll!SwWW8ImplReader::CoreLoad(WW8Glossary * pGloss, const SwPosition & rPos)  Line 4655	C++
 	msword.dll!SwWW8ImplReader::LoadThroughDecryption(SwPaM & rPaM, WW8Glossary * pGloss)  Line 5153 + 0x19 bytes	C++
 	msword.dll!SwWW8ImplReader::LoadDoc(SwPaM & rPaM, WW8Glossary * pGloss)  Line 5461 + 0x10 bytes	C++
 	msword.dll!WW8Reader::Read(SwDoc & rDoc, const String & rBaseURL, SwPaM & rPam, const String & __formal)  Line 5530 + 0xe bytes	C++
 	sw.dll!SwReader::Read(const Reader & rOptions)  Line 189 + 0x30 bytes	C++
 	sw.dll!SwDocShell::ConvertFrom(SfxMedium & rMedium)  Line 256 + 0xc bytes	C++
 	sfx.dll!SfxObjectShell::DoLoad()  + 0x7e4 bytes	


Crash happens in this line
    aGrid.SetLines(writer_cast<sal_uInt16>(nTextareaHeight/nLinePitch));
where nLinePitch is zero => division by zero.
Comment 3 Armin Le Grand 2013-06-19 15:22:39 UTC
ALG: Checked on Mac, crashes, too.
Comment 4 jsc 2013-06-24 12:18:22 UTC
set showstopper flag
Comment 5 Andre 2013-06-26 12:25:49 UTC
There seems to be a general problem with the bug doc.  MS Office 2013 opens the document in a protected view and reports "Office has detected a problem with this file. Editing it may harm your computer. Click for more details."  But there are no noteworthy details.

Replacing 

    aGrid.SetLines(writer_cast<sal_uInt16>(nTextareaHeight/nLinePitch));

with 

    if (nLinePitch > 0)
        aGrid.SetLines(writer_cast<sal_uInt16>(nTextareaHeight/nLinePitch));

results in the document being correctly loaded (looks the same as what MS Office shows in its viewer).
Maybe that is enough of a fix?
Comment 6 Oliver-Rainer Wittmann 2013-06-26 12:27:17 UTC
The given document is corrupt according to MS Word 2003, MS Word 2007, MS Word 2010 and MS Word 2013. MS Word versions are reporting that a problem with the file has been detected and that editing may harm your computer.
Comment 7 Oliver-Rainer Wittmann 2013-06-26 12:40:11 UTC
(In reply to Andre from comment #5)
> There seems to be a general problem with the bug doc.  MS Office 2013 opens
> the document in a protected view and reports "Office has detected a problem
> with this file. Editing it may harm your computer. Click for more details." 
> But there are no noteworthy details.
> 
> Replacing 
> 
>     aGrid.SetLines(writer_cast<sal_uInt16>(nTextareaHeight/nLinePitch));
> 
> with 
> 
>     if (nLinePitch > 0)
>         aGrid.SetLines(writer_cast<sal_uInt16>(nTextareaHeight/nLinePitch));
> 
> results in the document being correctly loaded (looks the same as what MS
> Office shows in its viewer).
> Maybe that is enough of a fix?

From my point of view with fix would be enough to fix the problem.
I have some further changes in mind to improve the corresponding method.
Comment 8 Oliver-Rainer Wittmann 2013-06-26 12:48:42 UTC
working on the fix which is definitely inspired by Andre ;-)
Comment 9 SVN Robot 2013-06-26 13:07:29 UTC
"orw" committed SVN revision 1496918 into trunk:
121977: WW8 import: apply grid property values, if grid is active and if the ...
Comment 10 Oliver-Rainer Wittmann 2013-06-26 13:16:41 UTC
fixed in trunk for AOO 4.0
Comment 11 liuping 2013-07-10 06:28:57 UTC
Verify on Mac OS 10.8 on   Rev. 1499347 ,pass ; maybe someone may verify on wondows8 OS
Comment 12 Rob Weir 2013-07-15 13:16:13 UTC
Verified with 4.0.0 RC on Windows 8 32-bit.  Document loads and displays without error.