[librsvg: 18/19] Test that the pixbuf API doesn't overflow



commit 1a90fba2fc3cbaf6c81c9820750ede3fb0f77bc1
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Apr 28 17:09:25 2020 -0500

    Test that the pixbuf API doesn't overflow
    
    Hopefully I'm not testing too little by only testing a single function
    - they all go through the same internals right now, with checks in a
    single place.

 tests/api.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
---
diff --git a/tests/api.c b/tests/api.c
index 488c02c3..de218f64 100644
--- a/tests/api.c
+++ b/tests/api.c
@@ -253,6 +253,18 @@ test_pixbuf (gconstpointer data)
     g_object_unref (pixbuf);
 }
 
+static void
+pixbuf_overflow (void)
+{
+    char *filename = get_test_filename ("example.svg");
+    GError *error = NULL;
+
+    g_assert (!rsvg_pixbuf_from_file_at_zoom (filename, 1000000.0, 1000000.0, &error));
+    g_assert_error (error, RSVG_ERROR, RSVG_ERROR_FAILED);
+    g_error_free (error);
+    g_free (filename);
+}
+
 static void
 noops (void)
 {
@@ -1399,6 +1411,8 @@ main (int argc, char **argv)
         g_test_add_data_func (pixbuf_tests[i].test_name, &pixbuf_tests[i], test_pixbuf);
     }
 
+    g_test_add_func ("/api/pixbuf_overflow", pixbuf_overflow);
+
     g_test_add_func ("/api/handle_has_gtype", handle_has_gtype);
     g_test_add_func ("/api/flags_registration", flags_registration);
     g_test_add_func ("/api/error_registration", error_registration);


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