Bug 70812 - FILEOPEN: docx file generated by latest pages (IOS7) crashes writer on open
Summary: FILEOPEN: docx file generated by latest pages (IOS7) crashes writer on open
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.1.2.3 release
Hardware: All All
: high critical
Assignee: Miklos Vajna
URL:
Whiteboard: BSA target:4.2.0 target:4.1.4
Keywords:
: 70893 71460 72046 72188 (view as bug list)
Depends on:
Blocks: 72043
  Show dependency treegraph
 
Reported: 2013-10-23 20:19 UTC by Aleks Clark
Modified: 2013-12-02 14:09 UTC (History)
10 users (show)

See Also:
Crash report or crash signature:


Attachments
Docx generated by pages (5.40 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2013-10-23 20:19 UTC, Aleks Clark
Details
Crash log Mac osx 10.9 (62.14 KB, text/plain)
2013-10-24 10:28 UTC, Thomas van der Meulen [retired]
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aleks Clark 2013-10-23 20:19:03 UTC
Created attachment 88053 [details]
Docx generated by pages

Problem description: 
opening files generated in Pages causes writer to crash

Steps to reproduce:
1. open the below file in 4.1.2.3
2. writer crashes


Current behavior:
writer crashes

Expected behavior:
unicorns and rainbows (also the document opens)

              
Operating System: Linux (Other)
Version: 4.1.2.3 release
Comment 1 Doug Mayer 2013-10-23 20:31:14 UTC
Confirmed this document (and others generated from Pages on iOS 7) crash LibreOffice Writer on opening. All of those documents open fine in Microsoft Word on Windows.

Operating System: Ubuntu Linux 13.04 x64
Version: 4.1.3 RC 1 released 10-Oct-2013
Comment 2 Thomas van der Meulen [retired] 2013-10-24 10:26:16 UTC
Thank you for your bug report, I can reproduce this bug running 
Version: 4.1.3.2
Build ID: 70feb7d99726f064edab4605a8ab840c50ec57a
OS: Mac osx 10.9.

The file opens with out a problem with Apple's Pages 4.3 
I think this bug is Critical because users who use Pages and save them in docx cannot use LibreOffice any more to open them.
Comment 3 Thomas van der Meulen [retired] 2013-10-24 10:28:11 UTC
Created attachment 88073 [details]
Crash log Mac osx 10.9
Comment 4 Julien Nabet 2013-10-25 19:34:21 UTC
On pc Debian x86-64 with master sources updated today, I reproduced the crash.
I noticed these logs:
warn:writerfilter:13196:1:writerfilter/source/dmapper/DomainMapper_Impl.cxx:435: no context of type 1 available
warn:writerfilter:13196:1:writerfilter/source/dmapper/DomainMapper.cxx:1487: DomainMapper::attribute() - Id: 9264 / 0x2430 value: 0 / 0x0

Aleks: could you attach the original odt file?
Comment 5 Doug Mayer 2013-10-25 19:51:01 UTC
Julien: For me, there was no original odt file. Create a document (with any content at all) in Pages on the iPad, export it as a .docx file, and Writer crashes. That same docx file works fine in Microsoft Word proper.
Comment 6 Julien Nabet 2013-10-25 19:52:34 UTC
Aleks: I understand better now. I didn't know Pages, sorry for the confusion.
Comment 7 Julien Nabet 2013-10-25 20:11:54 UTC
Some gdb session for the first message:
Breakpoint 1, writerfilter::dmapper::DomainMapper_Impl::GetTopContextOfType (this=0x1cd1730, eId=writerfilter::dmapper::CONTEXT_PARAGRAPH)
    at /home/julien/compile-libreoffice/libo/writerfilter/source/dmapper/DomainMapper_Impl.cxx:433
433	    PropertyMapPtr pRet;
(gdb) n
434	    SAL_WARN_IF( m_aPropertyStacks[eId].empty(), "writerfilter",
(gdb) p pRet
$1 = empty boost::shared_ptr
(gdb) p eId
$2 = writerfilter::dmapper::CONTEXT_PARAGRAPH
(gdb) p m_aPropertyStacks[eId].empty()
$3 = true
(gdb) n
[Thread 0x2aaace832700 (LWP 13421) exited]
warn:writerfilter:13384:1:writerfilter/source/dmapper/DomainMapper_Impl.cxx:435: no context of type 1 available

Miklos: I think you might be interested in this tracker so I put you in cc.
Comment 8 Julien Nabet 2013-10-26 15:25:53 UTC
*** Bug 70893 has been marked as a duplicate of this bug. ***
Comment 9 Roy Dyton 2013-11-07 13:49:35 UTC
Can also confirm that Emailed Pages Docx file from IPad air has crashed Libre office writerused in Ubuntu 13.10 and Windows Vista
Comment 10 Miklos Vajna 2013-11-07 14:58:42 UTC
I'll take care of this.
Comment 11 Commit Notification 2013-11-07 15:24:45 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

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

fdo#70812 writerfilter: check for nullptr after dynamic_cast



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 12 Aleks Clark 2013-11-08 17:04:06 UTC
Tested with attached file, file opens successfully.
Comment 13 Maxim Monastirsky 2013-11-11 07:05:50 UTC
*** Bug 71460 has been marked as a duplicate of this bug. ***
Comment 14 Miklos Vajna 2013-11-11 10:06:18 UTC
-4-1 review: https://gerrit.libreoffice.org/6636
Comment 15 Commit Notification 2013-11-11 21:37:17 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-4-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=88cb2a731bf445776adb6c047010bbd0dae3c633&h=libreoffice-4-1

fdo#70812 writerfilter: check for nullptr after dynamic_cast


It will be available in LibreOffice 4.1.4.

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 16 Maxim Monastirsky 2013-12-01 16:41:47 UTC
*** Bug 72046 has been marked as a duplicate of this bug. ***
Comment 17 Maxim Monastirsky 2013-12-01 16:51:14 UTC
*** Bug 72188 has been marked as a duplicate of this bug. ***
Comment 18 retired 2013-12-02 11:38:00 UTC
Fix verified on LO Version: 4.3.0.0.alpha0+
Build ID: a14cfd3d77104aee3e3c3d981a135161295197df
TinderBox: MacOSX-x86@49-TDF, Branch:master, Time: 2013-12-02_04:42:54

But another problem with this document seems to be that whenever pressing enter for a linebreak, instead a new page is created. Very strange. If anybody else also experiences that behavior, could you please create a new / separate bug for that attaching the example document from here.
Comment 19 Cor Nouws 2013-12-02 12:52:33 UTC
(In reply to comment #15)

> It will be available in LibreOffice 4.1.4.

Verified in 4.1.4.1
(Note: Each new paragraphs creates a new page due to the page > Text flow settings, but that may be intended.)
Comment 20 Doug Mayer 2013-12-02 14:07:40 UTC
I reported this about a week ago in https://bugs.freedesktop.org/show_bug.cgi?id=72043 - perhaps if others are able to verify it is any new-format DOCX (even from MS Word) we should revise that title.