Bug 81284 - Opening a zero sized file modifies it on the disk with garbage
Summary: Opening a zero sized file modifies it on the disk with garbage
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
(earliest affected) release
Hardware: All All
: medium major
Assignee: Maxim Monastirsky
Whiteboard: target:4.2.7
Depends on:
Reported: 2014-07-13 08:27 UTC by Rpnpif
Modified: 2014-07-21 10:16 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:
Regression By:


Note You need to log in before you can comment on or make changes to this bug.
Description Rpnpif 2014-07-13 08:27:50 UTC
To reproduce :

1. Create a zero sized file, as myfile.html or myfile.odt or other.
2. Open it in Libreoffice.
3. The file is displayed with garbage bytes. Without saving it, the file on the disk is modified !!
4. The Debian file command says after that : 
$ file myfile.html
Composite Document File V2 Document, No summary info.

Openoffice 4 has the same bug despite of an alert dialog box with a choice.

This bug should be considered as a security hole because it modifies unexpectedly a file. This file could have a role in the system as .gksu.lock or others.
All software must not modified involuntary an user file.

On Debian Wheezy 7.5.
Comment 1 Jean-Baptiste Faure 2014-07-13 19:57:52 UTC
Not reproducible for me with LibreOffice under Ubuntu 14.04 x86-64.
I created an empty file named new_test.odt. The file opened by LibreOffice is displayed empty and not changed when I close it without saving it (it is still O sized). Same behavior with a file named with html extension.

Best regards. JBF
Comment 2 Maxim Monastirsky 2014-07-14 08:20:02 UTC
Actually I fixed it for 4.3/master, but didn't backport to 4-2.
Comment 3 Commit Notification 2014-07-15 09:57:14 UTC
Maxim Monastirsky committed a patch related to this issue.
It has been pushed to "libreoffice-4-2":


fdo#81284 Don't write to zero length files

It will be available in LibreOffice 4.2.7.

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:
Affected users are encouraged to test the fix and report feedback.
Comment 4 Rpnpif 2014-07-21 10:16:32 UTC
(In reply to comment #3)

This patch seems to fix the bug for me (4.2.7 beta).

Thank you very much.