Bug 159496

Summary: An invalid ODF with an OLE fails to open, when asked to repair package interactively
Product: LibreOffice Reporter: Mike Kaganski <mikekaganski>
Component: LibreOfficeAssignee: Mike Kaganski <mikekaganski>
Status: RESOLVED FIXED    
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=159493
https://bugs.documentfoundation.org/show_bug.cgi?id=159474
Whiteboard: target:24.8.0 target:24.2.1
Crash report or crash signature: Regression By:
Attachments: An invalid ODT with an OLE

Description Mike Kaganski 2024-02-01 07:21:54 UTC
Created attachment 192314 [details]
An invalid ODT with an OLE

The attachment is simply a modified attachment 192313 [details], in which I edited META-INF/manifest.xml, replacing versions "1.3" with "1.2". This change created a mismatch between the versions in content.xml and in the manifest, which is detected in xmloff/source/core/xmlimp.cxx. Thus, when opening the document, a warning is expectedly shown, offering to try to repair the package. But confirming the prompt will fail with a "Read Error. Format error discovered in the file in sub-document content.xml at 2,4222(row,col)." message.

On the other hand, this macro works fine:
sub OpenRepairPackage
  url = ConvertToURL("Path/To/ODF_version_mismatch__with_OLE.odt")
  dim args(0) as new com.sun.star.beans.PropertyValue
  args(0).Name = "RepairPackage"
  args(0).Value = true
  StarDesktop.loadComponentFromURL(url, "_blank", 0, args())
end sub

so the file *can* be repaired, and the failure in the interactive case is a bug.
Comment 1 Commit Notification 2024-02-01 11:19:54 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/6bddbe51cee5c4aea023cc68771800f46a4aad2f

tdf#159496: clear mxObjectContainer in PrepareSecondTryLoad_Impl

It will be available in 24.8.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 2 Commit Notification 2024-02-02 12:20:06 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

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

tdf#159496: clear mxObjectContainer in PrepareSecondTryLoad_Impl

It will be available in 24.2.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.