Inkscape crash open wmf file

Bug #1616844 reported by Adrian Boguszewski
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
High
Tavmjong Bah

Bug Description

1. Start Inkscape
2. File -> Open
3. Select wmf file, Inkscape crashes

Fedora 20, rev 15073, release compiled with all dependencies except profiling
Crashes on Fedora 24 also.

Revision history for this message
Adrian Boguszewski (adrianboguszewski) wrote :
Revision history for this message
jazzynico (jazzynico) wrote :

Not reproduced on Windows XP (32-bit), Inkscape 0.48.5, 0.91 and 0.92.x rev. 15044.

Could you please give details on your operating system and Inkscape version?
Thanks!

Changed in inkscape:
importance: Undecided → High
tags: added: crash importing wmf
Changed in inkscape:
status: New → Incomplete
Revision history for this message
Adrian Boguszewski (adrianboguszewski) wrote :

Edited description

description: updated
description: updated
Changed in inkscape:
status: Incomplete → New
Revision history for this message
jazzynico (jazzynico) wrote :

Not reproduced on Xubuntu 16.04, Inkscape 0.91 and trunk rev. 15095.

Does it also crash with the Inkscape version packaged with Fedora (I guess 0.91)?

Revision history for this message
Adrian Boguszewski (adrianboguszewski) wrote :

No. Inkscape packaged with Fedora (rev. 13725) works.

description: updated
Revision history for this message
Alexander Brock (brock-alexander) wrote :

I can reproduce this on debian stretch 64 bit (4.8.0-1-amd64 #1 SMP Debian 4.8.5-1 (2016-10-28) x86_64 GNU/Linux) with Inkscape trunk (15278).
Attached is a stacktrace from a debug build. This also occurs with very simple wmf files, e.g. I made a rectangle in Inkscape, saved it as wmf and tried to load it but Inkscape crashed.

Revision history for this message
Alexander Brock (brock-alexander) wrote :

Simple wmf containing a rectangle, crashed Inkscape

Revision history for this message
jazzynico (jazzynico) wrote :

Tested again with the test files from comments #1 and #7, and still can't reproduce the crash on Xubuntu 16.04, lp:inkscape rev. 15281 and lp:inkscape/0.92.x rev. 15226.

Revision history for this message
prkos (prkos) wrote :

I get a crash on Ubuntu 14.04 0.92pre3 and r15261 as soon as I click on the file to see a Preview in the Open dialogue.

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

Not reproduced on Windows 10 x64 using 64-bit builds of
- Inkscape 0.92.1 r15371
- Inkscape trunk r15616 (MSYS2*)

From comment #9 and the stacktrace in comment #6 it seems likely that this is an issue with GdkPixbuf which is used for rendering of the preview in the GTK+ file chooser dialog (and not actually opening the file itself).

On Windows the preview loads eventually (*) but it takes a lot of time and a lot of memory (> 2 GB even for "drawing.wmf" from comment #7), so there definitely seems to be something wrong. Maybe this crashes when the system fails to allocate the ridiculous amount of memory?

(* Note to self: MSYS2 builds do not load the preview yet but only "No preview", probably due to some missing dependency.)

Revision history for this message
David Mathog (mathog) wrote :

Trunk rev 15016 on 32 bit XP.

If the test file is imported with file type "Windows Metafile (*.wmf)" it works and takes up very little memory, perhaps 1Mb. That uses the libUEMF import path. If it is imported with "wmf (*.wmf)" inkscape expands to use all memory on my machine and crashes.

I'm not sure which library provides the import for "wmf (*.wmf)", but it also seems to provide "emf (*.emf)", and that file type has the same problem with EMF files containing images. Conversely, "Enhanced Metafile (*.emf)", through libUEMF, works.

Revision history for this message
Tavmjong Bah (tavmjong-free) wrote :

Trying to import any file from a directory containing a WMF file crashes Inkscape. This is probably due to the Import dialog attempting to create a preview of the WMF file.

Revision history for this message
Tavmjong Bah (tavmjong-free) wrote :

"wmf (*.wmf)" is via GDK PixBuf import. Other GTK programs seem to be able to read in WMF files (e.g. ImageViewer).

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

@Tavmjong: What's suspicious is that your traceback points to "wmf_free()" in /src/libuemf/uwmf.c. (as does the one in comment #6). GdkPixbuf should not depend on libuemf at all if I'm not mistaken...

Revision history for this message
Alvin Penner (apenner) wrote :

- on Windows 10, Inkscape 0.92.1 r15371 (32 bit build)
- if I use the gtk open dialog and enable the preview, then I get the attached DOS error message.
- the wmf file opens properly, but the preview fails.

- on recent trunk, the preview works but takes a very long time
..................................................
(inkscape.exe:32): glibmm-CRITICAL **:
unhandled exception (type Glib::Error) in signal handler:
domain: gdk-pixbuf-error-quark
code : 1
what : Failed to load image 'C:\Windows\Temp\drawing.wmf': Couldn't load bitmap

(inkscape.exe:32): Gtk-CRITICAL **: gtk_widget_get_visible: assertion `GTK_IS_WIDGET (widget)' failed

Revision history for this message
Tavmjong Bah (tavmjong-free) wrote :

Preview is via GDK Pixbuf. If preview is disabled, one can open WMF files (via internal import). Trying to open WMF files using GDK (trunk, 0.92.x) crashes.

Using same GDK libraries:

0.48.x Preview works
0.91.x Preview works
0.92.x Preview crashes
trunk Preview crashes

Independent of fixing this crash, WMF input via GDK should probably be disabled. It results in a bitmap image rather than the vector image one gets via internal import.

Revision history for this message
Tavmjong Bah (tavmjong-free) wrote :

@Eduard

libwmf does contain a function wmf_free in api.h so it appears that we have a name conflict:

libwmf: api.h:

  extern void wmf_free (wmfAPI*,void*);

libuwmf: uwmf.h:

  int wmf_free(WMFTRACK **wt);

Revision history for this message
Tavmjong Bah (tavmjong-free) wrote :

I rename wmf_free to uwmf_free in trunk r15724. Seems to fix problem.

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

> I rename wmf_free to uwmf_free in trunk r15724. Seems to fix problem.

Still takes a lot of time and memory to load the preview on Windows (is this the same on Linux?).

I think we have two independent issues here:

1. Crashing issue on *nix, which was probably caused by the name conflict. On Windows however there is no libwmf, so there was also no name conflict.
2. Extremely poor performance generating the preview (exclusive to Windows?)

Revision history for this message
Patrick Storz (ede123) wrote :
Changed in inkscape:
assignee: nobody → Tavmjong Bah (tavmjong-free)
milestone: none → 0.92.2
Revision history for this message
Patrick Storz (ede123) wrote :

Follow up to the slow loading issue is bug #1707773
(*nix users: please check if this is Windows-only and report there...)

Patrick Storz (ede123)
Changed in inkscape:
status: New → Fix Committed
jazzynico (jazzynico)
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.