GNOME Bugzilla – Bug 647803
gdk_pixbuf_get_file_info() takes very long to determine the size of svgs with embedded jpgs
Last modified: 2017-12-13 17:47:20 UTC
Created attachment 185974 [details] Call of the broken gdk function. See: http://www.mail-archive.com/enlightenment-cvs@lists.sourceforge.net/msg07711.html and https://bugzilla.xfce.org/show_bug.cgi?id=2913 I could reproduce it with 2.23.3 with this file and the attached source: https://hubertscorner.de/drawing.svg Takes ~30 secs on my machine and as a result all programs which try determine the size of an svg that way
This may be a related issue: gdk_pixbuf_get_file_info() crashes for the following file. foo.svg: <?xml version="1.0" encoding="UTF-8" standalone="no" ?> <html><body><svg></svg></body></html> I've tested it with the following programm: file_info.c; #include <glib.h> #include <gdk-pixbuf/gdk-pixbuf-io.h> void main(){ g_type_init(); gint height, width; gdk_pixbuf_get_file_info("/path/to/foo.svg", &width, &height); } $ ./file_info (process:12606): GLib-CRITICAL **: g_hash_table_size: assertion `hash_table != NULL' failed (process:12606): GdkPixbuf-CRITICAL **: info_cb: assertion `width > 0 && height > 0' failed
I mixed things up. The program in the previous comment does not crash. However the output is right.
I can repro the problem with the empty svg from comment 1. However, I cannot retrieve the testcase from comment 0 since its server is down; any chance you can put it somewhere else or attach it here?
It put it back at http://hubertscorner.de/drawing.svg (note the missing https) You can easily reproduce such a svg file. just open inkscape, embed a jpeg file and copy & paste it multiple times. I think what happens it that the whole file is read to calculate the image’s dimensions, which is possible according the documentation of GDK. There can be a width and height attribute in SVGs top XML element to make it possible to determine the size of a SVG file in constant time. However both are not mandatory and as far as I can tell GDK ignores them. I can reproduce it with 2.24.0
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/librsvg/issues/51.