crash while opening CorelDRAW X8 file

Bug #1687090 reported by César Morgan
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Undecided
Patrick Storz
0.92.x
Fix Released
Undecided
Patrick Storz

Bug Description

Inkscape found an internal error while trying to open a file made in CorelDRAW X8, which has some advanced features (complex object extrusion, bitmap external alpha channel).
Other software (LibreOffice Draw) seems to open it, albeit removing such effects.

Inkscape seems to figure out that this document has 4 pages when importing it, but immediately crashes.

Related branches

Revision history for this message
César Morgan (xds-xps-ivx) wrote :
tags: added: cdr coreldraw
removed: cdrcoreldraw
Revision history for this message
Patrick Storz (ede123) wrote :

Reproduced on Windows 10 x64 with both
- Inkscape Inkscape 0.92.1 r15371 (stable release)
- Inkscape trunk r15647 (MSYS2 build)

Find attached a GDB backtrace as well as the Inkscape debug output at the time of the crash.

Changed in inkscape:
status: New → Confirmed
jazzynico (jazzynico)
tags: added: crash importing
removed: corel coreldraw
Revision history for this message
jazzynico (jazzynico) wrote :

Not reproduced on Windows XP (32-bit), Inkscape 0.92.1 and lp:inkscape/0.92.x rev. 15419 (official 32-bit devlibs). All 4 pages open in Inkscape without crashing.

Revision history for this message
Patrick Storz (ede123) wrote :

When using cdr2xhtml (part of libcdr, i.e. should produce more or less the same output as our input extension) and splitting the result into individual SVGs (see attachment) Inkscape is able to open all of them just fine.

This could indicate the crash is caused by the way we generate the SVG document in "Inkscape::Extension::Internal::CdrImportDialog::_setPreviewPage()". Possible cause is highlighted by the error messages in output.txt from comment #2: "parser error : AttValue length too long". Maybe Inkscape chokes on the huge images when they're read from memory rather then from a file.

If I remember correctly similar issues were also reported in other bugs lately.

Revision history for this message
Patrick Storz (ede123) wrote :

> If I remember correctly similar issues were also reported in other bugs lately.

Exactly: Possibly related bug #1572280, bug #1412912, bug #1373322
and especially bug #1243011, bug #1627004 (the latter two are specific to CDR import, therefore likely all instances of the same issue)

Revision history for this message
Patrick Storz (ede123) wrote :

Initial idea: Maybe the issue is in "SPDocument::createNewDocFromMem()"

Revision history for this message
Patrick Storz (ede123) wrote :

Inkscape built with 32-bit devlibs is probably not affected because it still uses libxml2 2.7.8 and the limit on attribute size was only introduced in 2.9.0 [1] as determined by su_v before.

[1] https://git.gnome.org/browse/libxml2/commit/?id=e17db9946c09af709d6b37c598b336b1d2ef18a5

Revision history for this message
Patrick Storz (ede123) wrote :

I think this can be fixed by replacing "xmlParseMemory()" [1] with "xmlReadMemory()" [2] and setting the xmlParserOption XML_PARSE_HUGE [3].

I'll start investigating if this fixes the issue as well as figuring out any potential compatibility concerns or other side effect.

[1] http://xmlsoft.org/html/libxml-parser.html#xmlParseMemory
[2] http://xmlsoft.org/html/libxml-parser.html#xmlReadMemory
[3] http://xmlsoft.org/html/libxml-parser.html#xmlParserOption

Revision history for this message
Patrick Storz (ede123) wrote :

Fix for the crashing issue pushed in
http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/revision/15653
(Inkscape fails gracefully now if a CDR/VSD preview page can not be rendered)

Fix for the underlying import failure pushed in
http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/revision/15654
(the attribute size limitations of libxml2-parser are relaxed now, as well as other restrictions, so many documents that failed to load before should be loaded just fine now)

Please test the change thoroughly. If no regressions are found I think both changes would be good candidates for backporting to 0.92.x.

Changed in inkscape:
status: Confirmed → Fix Committed
assignee: nobody → Eduard Braun (eduard-braun2)
jazzynico (jazzynico)
Changed in inkscape:
milestone: none → 0.93
tags: added: backport-proposed
Revision history for this message
Patrick Storz (ede123) wrote :
su_v (suv-lp)
tags: removed: backport-proposed
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.