Bug 157556 - Incorrect image link leads to corrupted document AFTER being saved in LibreOffice
Summary: Incorrect image link leads to corrupted document AFTER being saved in LibreOf...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.3.6.2 release
Hardware: All All
: high major
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Writer-Images Save
  Show dependency treegraph
 
Reported: 2023-10-02 11:07 UTC by devseppala
Modified: 2024-01-24 10:50 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Odt document containing erroneous image link, which corrupts the document AFTER saving in LO (32.33 KB, application/vnd.oasis.opendocument.text)
2023-10-02 11:07 UTC, devseppala
Details

Note You need to log in before you can comment on or make changes to this bug.
Description devseppala 2023-10-02 11:07:41 UTC
Created attachment 189947 [details]
Odt document containing erroneous image link, which corrupts the document AFTER saving in LO

If LibreOffice opens Writer document that contains an image, which is linked (in content.xml) with the following incorrect syntax:
<draw:image xlink:href="C:\LO_bug_erroneous_image_link\apples.gif" 

the document opens in LibreOffice correctly despite this error, except in the place of the image user is shown an error message, as it should be. However, if the user then saves (not ‘Save As’) the document, the originally wrong link becomes even more incorrect:
<draw:image xlink:href="./C:%5CLO_bug_erroneous_image_link%5Capples.gif"

After this, LibreOffice refuses to open the document with the following error message:

Read Error.
Format error discovered in the file in sub-document content.xml at 2,5102(row,col).

Evidently it is the ‘\’ character that is replaced by ‘%5C’, what is causing the document not to open.

LibreOffice does not allow the user to create incorrect links, but they can come from other programs. Also, LibreOffice import functions can be affected by this. This is why, I think LO should be more robust in handling incorrect links.

This problem has existed in LO for quite a while, I do not know what is the earliest affected version.

!!! THIS BUG DOES NOT HAPPEN WITH “Save As”, ONLY WITH “Save” !!!
Comment 1 devseppala 2023-10-02 11:37:34 UTC
Here is my system info:

Version: 7.6.2.1 (X86_64) / LibreOffice Community
Build ID: 56f7684011345957bbf33a7ee678afaf4d2ba333
CPU threads: 16; OS: Windows 10.0 Build 19045; UI render: Skia/Vulkan; VCL: win
Locale: fi-FI (fi_FI); UI: en-GB
Calc: CL threaded
Comment 2 devseppala 2023-10-02 12:35:56 UTC
Tested the bug also in a Ubuntu Linux VM:

Version: 7.3.7.2 / LibreOffice Community
Build ID: 30(Build:2)
CPU threads: 2; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Ubuntu package version: 1:7.3.7-0ubuntu0.22.04.1
Calc: threaded
Comment 3 m_a_riosv 2023-10-02 21:41:18 UTC
Reproducible with:
Version: 7.4.7.2 (x64) / LibreOffice Community
Build ID: 723314e595e8007d3cf785c16538505a1c878ca5
CPU threads: 16; OS: Windows 10.0 Build 22621; UI render: Skia/Raster; VCL: win
Locale: es-ES (es_ES); UI: es-ES Calc: CL
and
Version: 7.6.1.2 (X86_64) / LibreOffice Community
Build ID: f5defcebd022c5bc36bbb79be232cb6926d8f674
CPU threads: 16; OS: Windows 10.0 Build 22621; UI render: Skia/Vulkan; VCL: win
Locale: es-ES (es_ES); UI: en-US Calc: CL threaded
and
Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 9eb419b0b0f019f5fbc48ff1a11977e8b041edee
CPU threads: 16; OS: Windows 10.0 Build 22621; UI render: Skia/Raster; VCL: win
Locale: es-ES (es_ES); UI: en-US Calc: CL threaded Jumbo

regression from (not reproducible with):
Version: 7.2.7.2 (x64) / LibreOffice Community
Build ID: 8d71d29d553c0f7dcbfa38fbfda25ee34cce99a2
CPU threads: 16; OS: Windows 10.0 Build 22621; UI render: Skia/Raster; VCL: win
Locale: es-ES (es_ES); UI: es-ES Calc: CL
Comment 4 Kira Tubo 2023-10-02 22:53:36 UTC
Bibisected win64-7.3. Added Tomaž Vajngerl to cc. 

Regression occurring at: 
https://git.libreoffice.org/core/+/2bfad80805c248b47d099c1707ce4f1926867b82

---------------------

commit 2bfad80805c248b47d099c1707ce4f1926867b82	[log]
author	Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>	Wed Jul 20 22:01:31 2022 +0200
committer	Xisco Fauli <xiscofauli@libreoffice.org>	Wed Jul 27 16:48:14 2022 +0200
tree 9fd3033fbbb3696698665ed1906e693ed3b0a245
parent d4f5877a6a9bb5cbe70c5d60634aabe1282b96af [diff]

----------------------
 a0cf2b657093950abcebc063c38a83761efb0008 is the first bad commit
commit a0cf2b657093950abcebc063c38a83761efb0008
Author: Norbert Thiebaud <nthiebaud@gmail.com>
Date:   Wed Jul 27 07:57:25 2022 -0700

    source 2bfad80805c248b47d099c1707ce4f1926867b82

-----------------------

Reproduced on:

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: dd7fc07f83416a3d8a444947b7d28f7347520d6a
CPU threads: 6; OS: Windows 10.0 Build 22621; UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded
Comment 5 Stéphane Guillou (stragu) 2023-12-22 09:09:39 UTC
Upping the importance as it it a regression that results in a corrupt file. (see https://wiki.documentfoundation.org/images/0/06/Prioritizing_Bugs_Flowchart.jpg)

Thanks Kira for the bibisect. Commit is a cherrypick of d449da36086409e3cc440036193c4fc8a10a37a1, for bug 123983.

Still reproduced in:

Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 29b11fa3b5574dc3f42f55b0716f71054030c6c2
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Quikee, what do you think?
Comment 6 MaxWill 2024-01-24 10:50:25 UTC Comment hidden (spam)