Bug 56245 - Corruption reported on invalid ODT file
Summary: Corruption reported on invalid ODT file
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: x86-64 (AMD64) Linux (All)
: medium major
Assignee: Michael Stahl (allotropia)
URL:
Whiteboard: odf target:4.5.0 target:4.4.0.0.beta3
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-21 08:29 UTC by Jos van den Oever
Modified: 2014-12-05 11:08 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
the file that is said to be corrupted (3.84 KB, application/vnd.oasis.opendocument.text)
2012-10-21 08:29 UTC, Jos van den Oever
Details
Non-corrupted file with identical content. (9.30 KB, application/vnd.oasis.opendocument.text)
2012-10-30 19:58 UTC, Linus Drumbler
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jos van den Oever 2012-10-21 08:29:13 UTC
Created attachment 68862 [details]
the file that is said to be corrupted

A valid ODT file which has been checked by cyclone and officeotron on officeshots is reported as being corrupted in LibreOffice.
Comment 1 Roman Eisele 2012-10-21 12:27:32 UTC
Comment on attachment 68862 [details]
the file that is said to be corrupted

(Fixed MIME type.)
Comment 2 Linus Drumbler 2012-10-30 19:58:48 UTC
Created attachment 69331 [details]
Non-corrupted file with identical content.

On Windows 7 both Microsoft Word 2010 and LibreOffice 3.6.2.2 also say the file is corrupted. But then both manage to recover the source and display the correct content (assuming it is indeed "Hebban olla uogala nestas hagunnan hinase hi(c) (a)nda thu uuat unbidan uue nu"). However, I have created a file with identical content, which is not recognized as corrupted in any circumstances.
Comment 3 bfoman (inactive) 2013-05-09 11:36:17 UTC
(In reply to comment #2)
> On Windows 7 both Microsoft Word 2010 and LibreOffice 3.6.2.2 also say the
> file is corrupted.

Confirmed with:
LO 4.0.2.2
Build ID: own W7 debug build
Windows 7 Professional SP1 64 bit

The same results with Word 2010 and LibreOffice 4.0.2.2.

@reporter:
How is this file generated?
Comment 4 Jos van den Oever 2013-05-09 12:10:30 UTC
The file was created by editing content.xml and styles.xml from a file saved by Calligra 2.6.

Running validateODF.py and uploading to officeshots.org, which runs cyclone and officeotron, report that the file is valid.
Comment 5 bfoman (inactive) 2013-05-09 14:45:38 UTC
(In reply to comment #4)
> The file was created by editing content.xml and styles.xml from a file saved
> by Calligra 2.6.
> Running validateODF.py and uploading to officeshots.org, which runs cyclone
> and officeotron, report that the file is valid.

Does this file open correctly in other odf compatible text editor?
Comment 6 Jos van den Oever 2013-05-09 19:52:59 UTC
Yes, it opens fine in calligra and abiword.
Comment 7 Linus Drumbler 2013-05-12 22:56:58 UTC
FocusWriter can open it just fine as well.
Comment 8 Michael Stahl (allotropia) 2014-12-04 17:06:46 UTC
The error is detected from ZipPackageFolder::LookForUnexpectedODF12Streams()

the stream "Thumbnails/thumbnail.png" from the zip file does not have an entry in META-INF/manifest.xml

This is not a valid ODF 1.2 package.

see ODF 1.2 part 3, 3.2 Manifest:

For all files contained in a package, with exception of the “mimetype” file and files whose relative path starts with “META-INF/”, the “META-INF/manifest.xml” file _shall_ contain exactly one <manifest:file-entry> element whose manifest:full-path attribute's value references the file.


the ODF toolkit validator says:

output4630324524200115217.odt/META-INF/manifest.xml:  Error: The file 'Thumbnails/thumbnail.png' shall be listed in the 'META-INF/manifest.xml' file as it exists in the ODF package 'file:///output4630324524200115217.odt'!


The check was added in OOo 3.2.

So this works as designed (NOTABUG), except for one little issue:
the dialog that pops up offers to "repair" the file,
and in OOo 3.2 that will load the document, but on current master it fails.
Comment 9 Michael Stahl (allotropia) 2014-12-04 22:00:32 UTC
fixed the document repair on master (one of the coverity fixes went wrong)

resolving this as NOTABUG
Comment 10 Commit Notification 2014-12-04 22:01:33 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

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

sfx2: reset the error code before 2nd load with repair (related: fdo#56245)

It will be available in 4.5.0.

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 11 Commit Notification 2014-12-05 11:08:25 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-4-4":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=39ce75b14650819f88362b0e2fd2db9b1a8dcf71&h=libreoffice-4-4

sfx2: reset the error code before 2nd load with repair (related: fdo#56245)

It will be available in 4.4.0.0.beta3.

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.