Bug 140632 - LibreOffice wrongly reads OLE object in RTF
Summary: LibreOffice wrongly reads OLE object in RTF
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
(earliest affected) release
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Not Assigned
Depends on:
Blocks: RTF OLE-Objects
  Show dependency treegraph
Reported: 2021-02-24 07:27 UTC by fwwucn
Modified: 2023-01-27 14:40 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:

The rtf file in download link also be attached. (146.31 KB, text/rtf)
2021-02-24 07:33 UTC, fwwucn
Select 2nd OLE object (171.25 KB, image/png)
2021-02-24 09:41 UTC, fwwucn
paragraph inserted sample (159.84 KB, text/rtf)
2021-02-25 01:05 UTC, fwwucn

Note You need to log in before you can comment on or make changes to this bug.
Description fwwucn 2021-02-24 07:27:45 UTC
Using LibreOffice (I'm using the current latest LibreOffice on macOS) to open the rtf file (https://github.com/Redogame/sample-data/raw/main/sample.rtf), it didn't recognize the first OLE object, just read it as a normal object. So the object can't be double clicked to view it. But the 2nd OLE object is well recognized.

Can anybody help to figure out how to work around it or fix it?

Steps to Reproduce:
1. Download the rtf file (the download link is in description.)
2. Open the rtf file with LibreOffice.
3. There are 2 OLE objects in the rtf file (also have 1 text), but the first OLE object can't be clicked to view.

Actual Results:
The first OLE object can't be clicked to view, but the 2nd OLE object can.

Expected Results:
The first OLE object can be clicked to view.

Reproducible: Always

User Profile Reset: No

Additional Info:
I'm running LibreOffice on macOS 10.14.6.
Comment 1 fwwucn 2021-02-24 07:33:16 UTC
Created attachment 170016 [details]
The rtf file in download link also be attached.
Comment 2 Miklos Vajna 2021-02-24 07:51:01 UTC
Could you please clarify what app should open on double-click? Also, is this really meant to work on any operating system or just Windows?
Comment 3 fwwucn 2021-02-24 09:41:29 UTC
Created attachment 170020 [details]
Select 2nd OLE object
Comment 4 fwwucn 2021-02-24 09:47:51 UTC
The embeded OLE object is a chemical route, and should be opened by ChemDraw when double click in normal case, but the point is not here: With what app to open is not important.

You can confirm like this:
Switching selection between the 2 objects, you may find the LibreOffice toolbar & statusbar different, and there is a gray box around the 2nd OLE object while no box around the first one. When select the 2nd OLE object and double click, will show "Error activating object:
General OLE error.", which means it was recognized as an OLE object.

I attached a screenshot "Select 2nd OLE object" to help your understand.

> Also, is this really meant to work on any operating system or just Windows?
I tried it on macOS and Ubuntu 20.04, not sure on Windows.
Comment 5 fwwucn 2021-02-24 09:55:07 UTC
And FYI, if you can open the rtf file by Microsoft Word, you can find the both objects are embedded OLE objects and behave same.
Comment 6 Miklos Vajna 2021-02-24 10:12:44 UTC
Thanks for the additional info. Yes, if it works in Word, it should work in Writer. (I can't try this right now, so not setting to NEW.)
Comment 7 fwwucn 2021-02-25 01:04:16 UTC
Hi Miklos,

I found that if insert an empty paragraph before the 1st OLE object in the rtf file, LibreOffice can read the 2 OLE objects correctly and works well. The "paragraph inserted" rtf file is also attached. May this help you.

BTW, I have a large mount of RTF files, from which to extract OLE objects and save each object as a chemical route file (ChemDraw CDX format), so I wrote a Java program to call unoconv [https://github.com/unoconv/unoconv] to batch process, and this task is urgent. So if this issue can be fixed soon, how long need I wait until I can download the fixed release, or how can I apply the patch ASAP?
Comment 8 fwwucn 2021-02-25 01:05:18 UTC
Created attachment 170042 [details]
paragraph inserted sample
Comment 9 Miklos Vajna 2021-02-25 10:41:56 UTC
Just to set the correct expectations, nobody is paid to jump on this bug currently. Either wait till somebody has time to fix it, or fix it yourself or see https://www.libreoffice.org/get-help/professional-support/ for professional support.

The issue reported sounds interesting, but I don't currently have time to investigate more.
Comment 10 fwwucn 2021-02-25 11:08:39 UTC
Understood. Thanks for your kind help.
Comment 11 Julien Nabet 2021-04-24 12:23:56 UTC
On pc Debian x86-64 with master sources updated today, none of the 2 OLEs open.
But I noticed this log for the second one:
Throwing EndOfStreamException
gio: file:///tmp/luvpbtut.tmp/luvpbu02.tmp: No application is registered as handling this file
warn:legacy.osl:18761:18761:sw/source/uibase/wrtsh/wrtsh1.cxx:775: Can't get visual area size!

To compare both, I put a break in sw/source/uibase/docvw/edtwin.cxx:3335 (SwEditWin::MouseButtonDown).
Second object uses goes, as expected, in this branch:
"case SelectionType::Ole"

The first one goes in this branch:
"case SelectionType::DrawObject:"