[gdk-pixbuf] tests: Check that pixbufs are valid before comparing them
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdk-pixbuf] tests: Check that pixbufs are valid before comparing them
- Date: Fri, 17 Feb 2017 11:41:26 +0000 (UTC)
commit 0f538573aca0950eac37a407aed5529f41019200
Author: Philip Withnall <withnall endlessm com>
Date: Mon Feb 6 13:23:05 2017 +0000
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
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 d80f155..8050b30 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))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]