Bug 135144 - Saving DOCX to ODT with hiding tracking changes trashes all images
Summary: Saving DOCX to ODT with hiding tracking changes trashes all images
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.4.0.3 release
Hardware: All All
: medium critical
Assignee: Miklos Vajna
URL:
Whiteboard: target:7.1.0 target:7.0.1 target:6.4....
Keywords: bibisected, bisected, dataLoss, regression
: 135015 (view as bug list)
Depends on:
Blocks: Save
  Show dependency treegraph
 
Reported: 2020-07-26 11:03 UTC by Telesto
Modified: 2020-08-22 13:37 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file (21.26 MB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2020-07-26 11:04 UTC, Telesto
Details
Example file (smaller) (1.76 MB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2020-07-26 11:50 UTC, Telesto
Details
Before VS after ( LibreOffice 7.1 master ) (187.43 KB, image/png)
2020-08-05 13:24 UTC, Xisco Faulí
Details
minimal reproducer (41.20 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2020-08-05 13:51 UTC, Xisco Faulí
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Telesto 2020-07-26 11:03:42 UTC
Description:
Saving DOCX to ODT with hiding tracking changes trashes all images

Steps to Reproduce:
1. Open the attached file
2. Save to ODT
3. File reload -> Scroll through the doc

Actual Results:
Images missing/empty frames

Expected Results:
Not this


Reproducible: Always


User Profile Reset: No



Additional Info:
Found in 7.1

but not in 
6.2
Comment 1 Telesto 2020-07-26 11:04:21 UTC
Created attachment 163548 [details]
Example file
Comment 2 Telesto 2020-07-26 11:09:16 UTC
Not in
Version: 6.4.0.0.alpha0+ (x64)
Build ID: ef801197fcad9461390806a9fb42dd4566e55918
CPU threads: 4; OS: Windows 6.3; UI render: GL; VCL: win; 
Locale: nl-NL (nl_NL); UI-Language: en-US
Calc: CL
Comment 3 Telesto 2020-07-26 11:50:29 UTC
Created attachment 163550 [details]
Example file (smaller)
Comment 4 Aron Budea 2020-07-27 00:35:39 UTC
Confirmed using LO 7.1.0.0.alpha0+ (abea0d6647c7f1f7e76c73c26cb80e6a67dc5111) / Ubuntu.

Bibisected to the 6.3 backport of the following commit using repo bibisect-linux-64-6.3. Same commit as identified for bug 130707. Adding CC: to Miklos Vajna.

https://cgit.freedesktop.org/libreoffice/core/commit/?id=28d67b792724a23015dec32fb0278b729f676736
author		Miklos Vajna <vmiklos@collabora.com>	2019-08-26 20:57:10 +0200
committer	Miklos Vajna <vmiklos@collabora.com>	2019-08-27 09:15:23 +0200

tdf#107776 sw ODF shape import: make is-textbox check more strict
Comment 5 Miklos Vajna 2020-08-04 07:07:58 UTC
Now that bug 130707 is fixed, this is crashing in code introduced in core.git commit 522ed1b685f5b7eb52efb9d874dfacc02bf82139 (ofz#18563 sw: fix 2 problems with field marks, 2019-12-06). The immediate problem is:

Thread 1 "soffice.bin" received signal SIGSEGV, Segmentation fault.
0x00007fffcf0fb3fb in sw::CalcBreaks (rBreaks=std::__debug::vector of length 0, capacity 0, rPam=SwPaM = {...}, isOnlyFieldmarks=false)
    at /home/vmiklos/git/libreoffice/master/sw/source/core/doc/DocumentContentOperationsManager.cxx:561
561                                     assert(std::get<0>(startedFields.top())->IsCoveringPosition(SwPosition(rTextNode, i)));
(gdb) print startedFields
$1 = std::stack wrapping: std::__debug::deque with 1 element = {std::tuple containing = {[1] = 0x0, [2] = false, [3] = 0, [4] = 0}}

I.e. we unconditionally dereference std::get<0>(startedFields.top()), but it's a nullptr.

Michael Stahl: any idea what's going on here? Should I add a nullptr check there or is there a deeper problem here?

Steps to reproduce:

1) Open attachment 163550 [details] from this bug.
2) Save as ODT.
3) Open the ODT -> crash.

Sounds like a problem in the recently added CH_TXT_ATR_FIELDSEP feature.
Comment 6 Michael Stahl (allotropia) 2020-08-04 10:33:55 UTC
the problem from comment #5 is fixed in https://gerrit.libreoffice.org/c/core/+/100077
Comment 7 Commit Notification 2020-08-04 13:39:48 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/af38654b4b8388f0a0236601742b7ab3d1590ae8

tdf#135144 sw: copy bookmarks in SwDoc::CopyMasterHeader()

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 8 Xisco Faulí 2020-08-05 13:08:17 UTC
Hi Michael,
I do confirm your patch fixes the crash, however, the generated odt file is not ODF1.3 conformant. See bug 135463
Comment 9 Commit Notification 2020-08-05 13:11:27 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-7-0":

https://git.libreoffice.org/core/commit/ae3fb60f749066aa69dd1c32d2d963562a93eabb

tdf#135144 sw: copy bookmarks in SwDoc::CopyMasterHeader()

It will be available in 7.0.1.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Commit Notification 2020-08-05 13:14:42 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-6-4":

https://git.libreoffice.org/core/commit/ce10b3340c1b2e04a2ef9e0f454a64f898bff8cb

tdf#135144 sw: copy bookmarks in SwDoc::CopyMasterHeader()

It will be available in 6.4.7.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 11 Xisco Faulí 2020-08-05 13:24:22 UTC
Created attachment 163972 [details]
Before VS after ( LibreOffice 7.1 master )

The original issue is still reproducible in

Version: 7.1.0.0.alpha0+
Build ID: 76c40b82e6a44539cd43f326c00246e759449571
CPU threads: 4; OS: Linux 4.19; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 12 Xisco Faulí 2020-08-05 13:40:02 UTC
Hi Miklos, I've just checked in a local build including Michael's patch < af38654b4b8388f0a0236601742b7ab3d1590ae8 > and reverting your patch mentioned in comment 4 < 28d67b792724a23015dec32fb0278b729f676736 > does make the issue to go away, so I believe this is a regression
Comment 13 Xisco Faulí 2020-08-05 13:51:10 UTC
Created attachment 163973 [details]
minimal reproducer
Comment 14 Telesto 2020-08-05 14:43:07 UTC
*** Bug 135015 has been marked as a duplicate of this bug. ***
Comment 15 Commit Notification 2020-08-06 22:17:32 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/a0b531af93276db90f63a2fccde3694c46dcac83

tdf#135144: sw_odfexport: Add unittest for crash

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 16 Commit Notification 2020-08-12 11:19:22 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/347d05edd8910907ae185c61c1e56eee139b3c09

tdf#135144 xmloff textbox: fix export style name to be consitent with import

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 17 Xisco Faulí 2020-08-14 13:46:56 UTC
Verified in

Version: 7.1.0.0.alpha0+
Build ID: 1a524be53f62d2509920c2caa80817819f4aa9d9
CPU threads: 4; OS: Linux 4.19; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

@Miklos, thanks for fixing this issue!!
Comment 18 Commit Notification 2020-08-14 13:48:42 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-7-0":

https://git.libreoffice.org/core/commit/9902f6f7e567e6a1585833c751f5c19bf559705c

tdf#135144 xmloff textbox: fix export style name to be consitent with import

It will be available in 7.0.2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 19 Commit Notification 2020-08-22 13:37:41 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-7-0-1":

https://git.libreoffice.org/core/commit/25c20d74c3f3cf99648debb2bc7d752e33917cae

tdf#135144 xmloff textbox: fix export style name to be consitent with import

It will be available in 7.0.1.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.