[librsvg: 1/2] (#349): Don't panic when loading an external image that is bigger than Cairo's limits



commit 4386196b66904aea3a22668f021148e29b4f94c5
Author: Federico Mena Quintero <federico gnome org>
Date:   Thu Sep 27 12:55:19 2018 -0500

    (#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

 librsvg/rsvg-handle.c                                   | 4 ++++
 tests/fixtures/crash/349-too-big-image-in-href-data.svg | 1 +
 2 files changed, 5 insertions(+)
---
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"
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]