Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 399687 - media-gfx/gimp SVGs exported by app-office/libreoffice cause segmentation fault
Summary: media-gfx/gimp SVGs exported by app-office/libreoffice cause segmentation fault
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Sergey Torokhov
Depends on:
Reported: 2012-01-22 04:25 UTC by Jimmy C. Chau
Modified: 2020-03-05 23:33 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---

SVG file which causes segmentation fault in gimp (deerTruckStop.svg,527.23 KB, image/svg+xml)
2012-01-22 08:51 UTC, Jimmy C. Chau

Note You need to log in before you can comment on or make changes to this bug.
Description Jimmy C. Chau 2012-01-22 04:25:05 UTC
When trying to open a SVG file exported by LibreOffice Draw, it is able to render the SVG as a preview in the "Render Scalable Vector Graphics" window that appears, but upon clicking "OK" to actually open the file for editing, it creates a window titled "GIMP Message" containing the following:
GIMP Message
Opening '/tmp/gqviewcrash/deerTruckStop.svg' failed: Procedure 'file-svg-load' returned no return values

The following error message appears on the terminal used to start GIMP:
/usr/lib64/gimp/2.0/plug-ins/file-svg: fatal error: Segmentation fault

And the SVG does not appear for editing in GIMP.  

To reproduce:
1. Open LibreOffice Draw.
2. Make a sketch (optional; it'll crash even if the drawing is blank)
3. File -> Export...
   Export it as a "SVG - Scalable Vector Graphics (.svg)"
4. Open the generated SVG file in gimp.

Although some of the fault may lie with libreoffice (tested with both app-office/libreoffice-3.3.1 and app-office/libreoffice-l10n-3.4.5-r1), I believe that GIMP should not experience a segmentation fault despite any irregularities that libreoffice may introduce.  

Note that gqview also experiences problems with SVG files from libreoffice (as described in bug 399685).

emerge --info gqview libreoffice gimp:
Portage (hardened/linux/amd64, gcc-4.5.3, glibc-2.13-r4, 3.1.6-gentoo-2012Jan05 x86_64)
                        System Settings
System uname: Linux-3.1.6-gentoo-2012Jan05-x86_64-Intel-R-_Core-TM-2_Duo_CPU_U9400_@_1.40GHz-with-gentoo-2.0.3
Timestamp of tree: Sat, 21 Jan 2012 20:15:01 +0000
app-shells/bash:          4.1_p9
dev-java/java-config:     2.1.11-r3
dev-lang/python:          2.7.2-r3, 3.1.4-r3
dev-util/cmake:           2.8.6-r4
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.0.3
sys-apps/openrc:          0.9.4
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.11.1
sys-devel/binutils:       2.21.1-r1
sys-devel/gcc:            4.5.3-r1
sys-devel/gcc-config:     1.4.1-r1
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r1
sys-kernel/linux-headers: 3.1 (virtual/os-headers)
sys-libs/glibc:           2.13-r4
Repositories: gentoo x-portage
CFLAGS="-march=core2 -O2 -pipe -msse4.1"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=core2 -O2 -pipe -msse4.1"
FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en_US en"
MAKEOPTS="--jobs=4 --load-average=2"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
USE="X acl alsa amd64 berkdb bzip2 cairo caps cjk cli consolekit cracklib crypt cups cxx dbus dri dvd exif ffmpeg flac gdbm gnutls gpm hal hardened iconv ipv6 jpeg justify laptop lcms mmx modules mp3 mudflap multilib ncurses nls nptl nptlonly ogg opengl openmp pam pax_kernel pcre png ppds pppd readline sdl session spell sse sse2 ssl ssse3 sysfs system-sqlite tcpd theora threads truetype unicode urandom v4l vorbis xinerama xorg xv xvmc zlib" ALSA_CARDS="hda-intel usb-audio" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev synaptics" KERNEL="linux" LINGUAS="en_US en" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="intel" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

                        Package Settings

media-gfx/gqview-2.1.5 was built with the following:
USE="(multilib) -lcms"

app-office/libreoffice- was built with the following:
USE="branding dbus java (multilib) opengl (-aqua) -binfilter -custom-cflags -debug -eds -gnome -graphite -gstreamer -gtk -jemalloc -kde -mysql -nsplugin -odk -pdfimport -python -test -vba -webdav"
CFLAGS="-march=core2 -pipe"
CXXFLAGS="-march=core2 -pipe"

media-gfx/gimp-2.6.11-r5 was built with the following:
USE="alsa dbus exif jpeg lcms mmx (multilib) pdf png smp sse svg tiff -aalib (-altivec) -curl -debug -doc -gnome -mng -python -webkit -wmf"
Comment 1 Rafał Mużyło 2012-01-22 06:47:51 UTC
Some of the things missing in this report:
- an sample file that crashes gimp/gqview for you
- a backtrace of the crash
Comment 2 Jimmy C. Chau 2012-01-22 08:51:36 UTC
Created attachment 299505 [details]
SVG file which causes segmentation fault in gimp

Attached is a file that causes the segmentation fault.  I can generate more test files if you'd like (it seems like any SVG file that I export with LibreOffice Draw causes the segmentation fault).  

I'm having trouble generating the backtrace though.  I tried following the instructions at but gdb doesn't seem to notice the segmentation fault.  (I set the CFLAGS, CXXFLAGS, USE, and FEATURES environment variables as described in the bugzilla-howto and re-emerged gimp.)

Here's what I have from gdb: gdb --args gimp deerTruckStop.svg 
GNU gdb (Gentoo 7.3.1 p2) 7.3.1
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
For bug reporting instructions, please see:
Reading symbols from /usr/bin/gimp...done.
(gdb) run
Starting program: /usr/bin/gimp deerTruckStop.svg
[Thread debugging using libthread_db enabled]

(gimp:794): GLib-WARNING **: goption.c:2168: ignoring no-arg, optional-arg or filename flags (8) on option of type 0
[New Thread 0x7fffed9fb700 (LWP 797)]
[New Thread 0x7fffed1fa700 (LWP 798)]
/usr/lib64/gimp/2.0/plug-ins/file-svg: fatal error: Segmentation fault
[Thread 0x7fffed1fa700 (LWP 798) exited]
[Thread 0x7fffed9fb700 (LWP 797) exited]
[Inferior 1 (process 794) exited normally]
(gdb) bt
No stack.
(gdb) quit

I'll try to figure out how to get a backtrace on my own, but do you have any suggestions for me?  Thanks.
Comment 3 Jimmy C. Chau 2012-01-22 09:20:42 UTC
Got it, following <>, I attached gdb to GIMP's file-svg plugin.  

GIMP_PLUGIN_DEBUG=file-svg gimp ./deerTruckStop.svg

gdb /usr/lib64/gimp/2.0/plug-ins/file-svg 1032

[The starting output of gdb was long and is omitted; let me know if you want it.]

(gdb) continue

Program received signal SIGSEGV, Segmentation fault.
0x00007f9dd80d063d in rsvg_cairo_to_pixbuf () from /usr/lib64/
(gdb) bt
#0  0x00007f9dd80d063d in rsvg_cairo_to_pixbuf () from /usr/lib64/
#1  0x00007f9dd80d157f in rsvg_handle_get_pixbuf_sub () from /usr/lib64/
#2  0x00007f9dd9573bbe in load_rsvg_pixbuf (filename=<optimized out>, vals=<optimized out>, error=0x7fffc3361220) at file-svg.c:493
#3  0x00007f9dd95743b2 in load_image (filename=0x7f9dd9f06170 "/tmp/gqviewcrash/./deerTruckStop.svg", load_error=0x7fffc33612f0) at file-svg.c:326
#4  0x00007f9dd957591c in run (name=<optimized out>, nparams=<optimized out>, param=0x7f9dd9f06050, nreturn_vals=0x7fffc33613e4, return_vals=<optimized out>) at file-svg.c:230
#5  0x00007f9dd8bcc263 in gimp_proc_run (proc_run=0x7f9dd9ef32e0) at gimp.c:1917
#6  gimp_loop () at gimp.c:1751
#7  gimp_main (info=<optimized out>, argc=<optimized out>, argv=<optimized out>) at gimp.c:487
#8  0x00007f9dd9575c93 in main (argc=<optimized out>, argv=<optimized out>) at file-svg.c:94
Comment 4 Franz Trischberger 2012-01-22 12:28:52 UTC
I tried it. No problem. But it consumes quite a lot of memory during import, ~4GB! (When I don't change default size offered by the import-dialog)
If you have enough memory, you could try rebuilding librsvg and cairo.
Comment 5 Jimmy C. Chau 2012-01-22 20:11:44 UTC
You're right.  I have 4GB of memory plus 8GB of swap, but I do notice now that by default, the image is huge and that my memory usage reaches 87% when the segmentation fault occurs (though my swap is mostly free at 6% usage).   

But I rebuilt librsvg, cairo, and gimp anyway (with the debugging environment variables).  Here's another backtrace of GIMP's file-svg plug-in:

(gdb) continue

Program received signal SIGSEGV, Segmentation fault.
rsvg_cairo_to_pixbuf (pixels=0x7f799e136010 "", rowstride=86360, height=27940) at /usr/include/bits/string3.h:52
52        return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));
(gdb) bt
#0  rsvg_cairo_to_pixbuf (pixels=0x7f799e136010 "", rowstride=86360, height=27940) at /usr/include/bits/string3.h:52
#1  0x00007f7a3c314c3d in rsvg_handle_get_pixbuf_sub (handle=0x7f7a3df1a940, id=0x0) at rsvg.c:102
#2  0x00007f7a3c314cea in rsvg_handle_get_pixbuf (handle=<optimized out>) at rsvg.c:137
#3  0x00007f7a3d7b6bbe in load_rsvg_pixbuf (filename=<optimized out>, vals=<optimized out>, error=0x7fff991dd560) at file-svg.c:493
#4  0x00007f7a3d7b73b2 in load_image (filename=0x7f7a3df19170 "/tmp/gqviewcrash/./deerTruckStop.svg", load_error=0x7fff991dd630) at file-svg.c:326
#5  0x00007f7a3d7b891c in run (name=<optimized out>, nparams=<optimized out>, param=0x7f7a3df19050, nreturn_vals=0x7fff991dd724, return_vals=<optimized out>) at file-svg.c:230
#6  0x00007f7a3ce0f263 in gimp_proc_run (proc_run=0x7f7a3df062e0) at gimp.c:1917
#7  gimp_loop () at gimp.c:1751
#8  gimp_main (info=<optimized out>, argc=<optimized out>, argv=<optimized out>) at gimp.c:487
#9  0x00007f7a3d7b8c93 in main (argc=<optimized out>, argv=<optimized out>) at file-svg.c:94
(gdb) continue
[Inferior 1 (process 25050) exited normally]
Comment 6 Rafał Mużyło 2012-01-23 09:36:24 UTC
Well, this is a double funny:
- for me it doesn't seem to crash...well, at least till I interrupt it, as it does the memory consumption thing too (I'm still on x86 here)
- on the other hand, rsvg-view{,-3} display the file almost instantly
Comment 7 Pacho Ramos gentoo-dev 2016-05-24 10:53:11 UTC
In my case gimp tries to use a huge size when trying to opening the file and, then, it eats of the memory. But if I choose a lower size, it is able to load it

I would report this directly to upstream to know why gimp is trying to use that size
Comment 8 Sebastian Pipping gentoo-dev 2016-10-08 21:09:59 UTC
Took it to upstream now:
Comment 9 Jonas Stein gentoo-dev 2020-03-04 21:22:11 UTC
Upstream reports that it is fixed now:
please test and report
Comment 10 Sergey Torokhov 2020-03-05 23:33:30 UTC
I tested it for 2.10.14 and LaTeX svg logo from gimp issue tracker and it was successfully opened.

As for attached svg I'm not able to open it by default as it eat all my 4gb ram and 2 of swap. After reducing imported image size in 10 times to ~ 2000x2700 then svg quickly and successfully was opened.

If it's ok on gimp 2.10.18 then could I close issue?