Bug 80748

Summary: FILESAVE: File getting corrupted after RT due to paragraph gets added into run which has a framePr
Product: LibreOffice Reporter: Rohit Deshmukh <rohit.deshmukh>
Component: WriterAssignee: Not Assigned <libreoffice-bugs>
Status: VERIFIED FIXED    
Severity: normal CC: jluth, jorendc, lukebenes, vmiklos, xiscofauli
Priority: medium    
Version: 4.4.0.0.alpha0+ Master   
Hardware: Other   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=75573
https://bugs.documentfoundation.org/show_bug.cgi?id=78590
https://bugs.documentfoundation.org/show_bug.cgi?id=103544
https://bugs.documentfoundation.org/show_bug.cgi?id=131420
Whiteboard: BSA target:4.4.0
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 103305    
Attachments: Original file
FDO78590b.docx - with paragraphs above and below the graphic (lost when roundtripped)

Description Rohit Deshmukh 2014-07-01 06:11:10 UTC
Created attachment 102051 [details]
Original file

Steps to reproduce :
1] Open attached DOCX in LibreOffice
2] Perform save_as DOCX
3] Open saved file in MS Office 2010

Current behavior :
File gets corrupted

Expected behavior :
File should open without any warning or error.
Operating System: All
Version: 4.4.0.0.alpha0+ Master
Comment 1 Commit Notification 2014-07-03 13:37:52 UTC
Rohit Deshmukh committed a patch related to this issue.
It has been pushed to "master":

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

fdo#80748: Fix for file corruption due to framePr



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 2 Justin L 2016-07-29 08:28:57 UTC
Created attachment 126462 [details]
FDO78590b.docx - with paragraphs above and below the graphic (lost when roundtripped)

The fix in comment 1 causes one paragraph to disappear each time LO saves the file, so both the "Before graphic" and "After graphic" paragraphs will be deleted after a couple of round-trips.

This fix just throws information away to avoid corruption.  It looks like a couple of "w:pict"s eventually get converted into a couple of "mc:AlternateContent" by the second save, and that is likely what is causing the corruption.  MergeMarks::IGNORE discards the pict information (as well as anything else) and so avoids corruption, but introduces data loss.
Comment 3 Justin L 2016-08-01 05:29:47 UTC
(In reply to Commit Notification from comment #1)

The unit-test referred to in the commit is from bug 78590 and was a copy/paste of the model unit-test above it. The description was left unchanged, so it doesn't at all reflect what is being tested.