diff options
author | Philip Withnall <withnall@endlessm.com> | 2017-02-06 13:23:05 +0000 |
---|---|---|
committer | Philip Withnall <withnall@endlessm.com> | 2017-02-17 11:10:34 +0000 |
commit | 0f538573aca0950eac37a407aed5529f41019200 (patch) | |
tree | 14059289ded3537853b81119baa0f8f7092f3757 | |
parent | aa19439a1891de85b2445c7a8848805173cb2add (diff) | |
download | gdk-pixbuf-0f538573aca0950eac37a407aed5529f41019200.tar.gz |
tests: Check that pixbufs are valid before comparing them
Assert that the pixbufs have non-negative dimensions before comparing
them and potentially using one of the dimensions as a loop bound.
Coverity IDs: 1399711, 1399712
https://bugzilla.gnome.org/show_bug.cgi?id=776990
-rw-r--r-- | tests/pixbuf-scale-two-step.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/pixbuf-scale-two-step.c b/tests/pixbuf-scale-two-step.c index d80f155e7..8050b30c5 100644 --- a/tests/pixbuf-scale-two-step.c +++ b/tests/pixbuf-scale-two-step.c @@ -63,6 +63,11 @@ pixdata_almost_equal (GdkPixbuf *one, GdkPixbuf *two) guchar *two_pixel; /* Pointer to current pixel data in two */ guint x, y; + g_assert_cmpint (gdk_pixbuf_get_height (one), >=, 0); + g_assert_cmpint (gdk_pixbuf_get_width (one), >=, 0); + g_assert_cmpint (gdk_pixbuf_get_height (two), >=, 0); + g_assert_cmpint (gdk_pixbuf_get_width (two), >=, 0); + if (gdk_pixbuf_get_width (one) != gdk_pixbuf_get_width (two) || gdk_pixbuf_get_height (one) != gdk_pixbuf_get_height (two)) { |