diff options
author | Federico Mena Quintero <federico@gnome.org> | 2018-09-27 12:55:19 -0500 |
---|---|---|
committer | Federico Mena Quintero <federico@gnome.org> | 2018-09-27 13:21:59 -0500 |
commit | aac9e28226adb829b20fcbf2a0cd5cde50d25bc5 (patch) | |
tree | 984ce48a000e8d7678c9c97e4197203ee0b3cdd0 | |
parent | 89429e9eb9b9cb9d66872c60eeff5c13b529fa18 (diff) | |
download | librsvg-aac9e28226adb829b20fcbf2a0cd5cde50d25bc5.tar.gz |
(#349): Don't panic when loading an external image that is bigger than Cairo's limits
We were failing to return a GError, and the Rust code panicked in
from_glib_full(error), as error = NULL then.
https://gitlab.gnome.org/GNOME/librsvg/issues/349
-rw-r--r-- | librsvg/rsvg-handle.c | 4 | ||||
-rw-r--r-- | tests/fixtures/crash/349-too-big-image-in-href-data.svg | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/librsvg/rsvg-handle.c b/librsvg/rsvg-handle.c index 67c25bae..b500f3ae 100644 --- a/librsvg/rsvg-handle.c +++ b/librsvg/rsvg-handle.c @@ -1764,6 +1764,10 @@ rsvg_cairo_surface_new_from_href (RsvgHandle *handle, } surface = rsvg_cairo_surface_from_pixbuf (pixbuf); + if (!surface) { + g_set_error (error, RSVG_ERROR, RSVG_ERROR_FAILED, "could not convert pixbuf to cairo surface"); + goto out; + } if (mime_type == NULL) { /* Try to get the information from the loader */ diff --git a/tests/fixtures/crash/349-too-big-image-in-href-data.svg b/tests/fixtures/crash/349-too-big-image-in-href-data.svg new file mode 100644 index 00000000..b17bb165 --- /dev/null +++ b/tests/fixtures/crash/349-too-big-image-in-href-data.svg @@ -0,0 +1 @@ +<image xlink:href="data:image/jpeg;base64,/9j00f/bAIQA0000000000000000000000000000000000000000000000000000000000000000000000000000000000000AE0000000000000000000000000000000000000000000000000000000000000000000000000000000000000/8AAEQgA0+00AwEiAAIRAQ0RAf/aAAwDAQACEQ0R0000" |