Issue 123042 - [SVG] Crash: svg with image element fails to insert as linked graphic in Draw
Summary: [SVG] Crash: svg with image element fails to insert as linked graphic in Draw
Status: CLOSED FIXED
Alias: None
Product: Draw
Classification: Application
Component: open-import (show other issues)
Version: 3.4.1
Hardware: All All
: P3 Normal with 2 votes (vote)
Target Milestone: 4.1.0
Assignee: Armin Le Grand
QA Contact: Michael Rutherford
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-15 14:38 UTC by Regina Henschel
Modified: 2017-05-20 10:35 UTC (History)
7 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: 4.0.1
Developer Difficulty: ---


Attachments
zip-Container with svg-graphic and picture, which is linked from the svg-graphic (12.19 KB, application/zip)
2013-08-15 14:38 UTC, Regina Henschel
no flags Details
printf results (8.27 KB, application/zip)
2013-08-15 21:39 UTC, Regina Henschel
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description Regina Henschel 2013-08-15 14:38:20 UTC
Created attachment 81335 [details]
zip-Container with svg-graphic and picture, which is linked from the svg-graphic

Open the attached zip container. It contains a svg graphic, which links to the confetti-picture.

Launch Draw, Impress or Calc and insert the svg graphic via Insert > Picture with unchecked link (so embedded graphic). No problem.

Launch Draw, Impress or Calc and insert the svg graphic via Insert > Picture as _linked_ graphic. Crash.

Open the svg graphic via File > Open. No problem.

Launch Writer and insert the svg graphic via Insert > Picture, linked or embedded. No Problem.

@Oliver: The problem here can already be seen in r1471628. So it is independent from the crash in bug 122912 and its fix in bug 122600. The problem described here is the root cause for the crash with the test-suite file conform-viewers-03-f.svg, which i sent you.
Comment 1 Rainer Bielefeld 2013-08-15 15:03:52 UTC
CRASH is Reproducible with  "AOO 4.0.0-Dev – German UI / German locale - [AAOO400m3(Build:9702)  -  Rev. 1513120  2013-08-13]" on German WIN7 Home
Premium (64bit)", own separate user profile.

Additional observations:
a) no crash when I first do menu 'Insert -> Picture form File - 
   Linked = UNCHECKED" and then insert as linked picture'.
b) "Crash Protection" of (a) only works as long as unlinkec.SVG is in .DWG, CRASH
   reappears if unlinked.SVG has been deleted before I insert linked.SVG
c) For me already crashes with 3.4.1 Revision 1372282
Comment 2 Edwin Sharp 2013-08-15 16:28:41 UTC
No crash with Impress Rev. 1503704 Win 7.
Comment 3 Regina Henschel 2013-08-15 16:55:30 UTC
@Edwin: You have insert as _linked_ picture?
Comment 4 Edwin Sharp 2013-08-15 17:15:01 UTC
This is what I did:

http://screencast.com/t/QRDwDT3p

PS since comment 2 updated revision.
Comment 5 Regina Henschel 2013-08-15 17:30:51 UTC
@Edwin: That is embedded. In the import dialog is a checkbox "Link" (bottom, center). You have to check it to get a linked graphic.
Comment 6 Edwin Sharp 2013-08-15 18:12:19 UTC
I get the crash now...
Comment 7 Regina Henschel 2013-08-15 21:39:07 UTC
Created attachment 81338 [details]
printf results

I have made some printf. In the crash case there are three faulty calls to SvgDocHdl::startElement and SvgImageNode::decomposeSvgNode after the correct one. I'll attach the two source files with the printf, so that you can see where printf are; and the print result for inserting as embedded graphic, and the print result for inserting as linked graphic. Perhaps it helps a little bit.
Comment 8 Oliver-Rainer Wittmann 2013-08-16 09:29:14 UTC
Investigation reveals the following:
- Intrinsic import of SVG graphic goes well.
- Triggered via <sd::View::CheckPossibilities> another decomposition of the SVG graphic takes place which does not have the file path to the imported SVG graphic. When trying the resolve the path to the inner linked graphic using <rtl::Uri::convertRelToAbs( rPath, maUrl )> a <MalformedUriException> exception is thrown, because <rPath> is an empty string. The exception is not caught --> crash.
Comment 9 etiffany 2014-01-09 15:13:23 UTC
I am able to reproduce this bug by importing a SVG diagram into Writer (in 4.0.1). 

The diagram imports into the Writer document properly, and I'm even able to print a PDF, but soon after the Writer app is in the background it crashes with exception of type rtl::MalformedUriException.

This is on MacOS 10.9.1 with OOo 4.0.1.
Comment 10 Armin Le Grand 2014-01-17 00:01:12 UTC
I will have a look...
Comment 11 Armin Le Grand 2014-01-17 00:49:53 UTC
The SVG interpreter needs a valid path when the SVG contains links itself, this is the base to resolve the links. This path is missing, mainly because the link reloader in ImpLoadLinkedGraphic (which is a local helper to SdrGrafObj) does not give it to the GraphicFilter::ImportGraphic call. It does not give it since it previously opens the file data itself using an SfxMedium instance and a DownLoad call, constructing an own local SvStream with the file data.
This means that theoretically every GraphicFileFormat which contains links itself will fail and that the same sh<back><back> thing is done in the other applications somewhere.
Comment 12 Armin Le Grand 2014-01-17 01:05:55 UTC
Added code to the SVG interpreter to not crash but assert when the absolute link to itself (the file) is missing and a link is to be interpreted. Checking now if handing over the path in ImpLoadLinkedGraphic works...
Comment 13 Armin Le Grand 2014-01-17 01:15:55 UTC
Works like a charm; now I need to test if normal links still work (checked what GraphicFilter::ImportGraphic does with the given filename, is not used in the given configuration and thus should be okay). Also need to see what the other apps do in the same situation - or better where is the same problem in the other apps?
Comment 14 Armin Le Grand 2014-01-17 01:22:09 UTC
Writer imports okay, but looses linked image on reload (there was the crash before in SVG interpreter). Seems as if here the problem is in SvFileObject::GetGraphic_Impl. Checking...
Comment 15 Armin Le Grand 2014-01-17 01:25:47 UTC
Works as expected, all good after reload. Checking Calc...
Comment 16 Armin Le Grand 2014-01-17 01:28:44 UTC
Calc works well due to the changes in ImpLoadLinkedGraphic for SdrGrafObj. All apps allow insert and save/reload cycle with the changes applied. Doing some more tests with other linked graphics...
Comment 17 Armin Le Grand 2014-01-17 01:34:45 UTC
In all apps modified link, broke link, all with in-between save and reload, all work well. Used bitmap graphics linked and unlinked. Preparing commit...
Comment 18 SVN Robot 2014-01-17 01:37:01 UTC
"alg" committed SVN revision 1558977 into trunk:
i123042 corrected reload of linked content to have access to it's own path
Comment 19 Armin Le Grand 2014-01-17 01:37:52 UTC
Okay, done. Interesting is if all the helpers in svdograf.cxx like SdrGraphicUpdater and SdrGraphicLink may be replaceable with SvFileObject as Writer uses it...
Comment 20 Oliver-Rainer Wittmann 2014-04-02 11:15:58 UTC
Verified on Ubuntu 10.04 (64bit) with build from branch AOO410 (rev. 1583666)

Verified on Windows 7 with local build of branch AOO410, rev. 1582710 and with buildbot build, rev. 1582709