[gdk-pixbuf] tests: Add test case for bug 775218



commit 7fc0cc2cc8809bbec3cf80e655c40944f6760698
Author: Tobias Mueller <muelli cryptobitch de>
Date:   Mon Dec 12 16:17:04 2016 +0100

    tests: Add test case for bug 775218
    
    https://bugzilla.gnome.org/show_bug.cgi?id=775218

 tests/Makefile.am   |    1 +
 tests/bug775218.jpg |  Bin 0 -> 8344 bytes
 tests/pixbuf-jpeg.c |   18 ++++++++++++++++++
 3 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c765382..40c3477 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -59,6 +59,7 @@ dist_installed_test_data =            \
        cve-2015-4491.bmp               \
        large.png                       \
        large.jpg                       \
+       bug775218.jpg                   \
        $(wildcard $(srcdir)/test-images/fail/*) \
        $(wildcard $(srcdir)/test-images/randomly-modified/*) \
        $(wildcard $(srcdir)/test-images/reftests/*.*) \
diff --git a/tests/bug775218.jpg b/tests/bug775218.jpg
new file mode 100644
index 0000000..510a442
Binary files /dev/null and b/tests/bug775218.jpg differ
diff --git a/tests/pixbuf-jpeg.c b/tests/pixbuf-jpeg.c
index 351fa20..073104a 100644
--- a/tests/pixbuf-jpeg.c
+++ b/tests/pixbuf-jpeg.c
@@ -79,6 +79,23 @@ test_type9_rotation_exif_tag (void)
   g_object_unref (ref);
 }
 
+static void
+test_bug_775218 (void)
+{
+  GError *error = NULL;
+  GdkPixbuf *ref;
+
+  if (!format_supported ("jpeg"))
+    {
+      g_test_skip ("format not supported");
+      return;
+    }
+
+  ref = gdk_pixbuf_new_from_file (g_test_get_filename (G_TEST_DIST, "bug775218.jpg", NULL), &error);
+  g_assert_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_CORRUPT_IMAGE);
+  g_clear_object (&ref);
+}
+
 int
 main (int argc, char **argv)
 {
@@ -86,6 +103,7 @@ main (int argc, char **argv)
 
   g_test_add_func ("/pixbuf/jpeg/inverted_cmyk_jpeg", test_inverted_cmyk_jpeg);
   g_test_add_func ("/pixbuf/jpeg/type9_rotation_exif_tag", test_type9_rotation_exif_tag);
+  g_test_add_func ("/pixbuf/jpeg/bug775218", test_bug_775218);
 
   return g_test_run ();
 }


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