summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <philip@tecnocode.co.uk>2017-01-07 17:03:34 +0000
committerPhilip Withnall <withnall@endlessm.com>2017-02-07 11:27:24 +0000
commitab921f069d2624de547c9a15252fb278de2baf13 (patch)
tree93c3ca6964fc3aabe948808d91add09541909c62
parent3a53fc42e56f6c5fb896f557d5e892f14528fa47 (diff)
downloadgdk-pixbuf-ab921f069d2624de547c9a15252fb278de2baf13.tar.gz
thumbnailer: Update from gnome-thumbnailer-skeleton master
https://github.com/hadess/gnome-thumbnailer-skeleton/commits/master Add some assertions to help Coverity From looking at the code, these assertions should always hold already, but it clarifies the code and helps static analysis if we add them explicitly. (n_pixels == 0) is only true if (s_x1 == s_x2 || s_y1 == s_y2), which is only true if (dx == 0 || dy == 0). This cannot be true, because dx and dy are the result of dividing source_[width|height] by dest_[width|height], and there’s already an assertion that the former are greater or equal to the latter. Coverity CID: 1388528 https://bugzilla.gnome.org/show_bug.cgi?id=776990
-rw-r--r--thumbnailer/gnome-thumbnailer-skeleton.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/thumbnailer/gnome-thumbnailer-skeleton.c b/thumbnailer/gnome-thumbnailer-skeleton.c
index 10b8d73cb..d686432c2 100644
--- a/thumbnailer/gnome-thumbnailer-skeleton.c
+++ b/thumbnailer/gnome-thumbnailer-skeleton.c
@@ -88,6 +88,9 @@ gnome_desktop_thumbnail_scale_down_pixbuf (GdkPixbuf *pixbuf,
dy = ddy.quot;
dy_frac = ddy.rem;
+ g_assert (dx >= 1);
+ g_assert (dy >= 1);
+
has_alpha = gdk_pixbuf_get_has_alpha (pixbuf);
source_rowstride = gdk_pixbuf_get_rowstride (pixbuf);
src_pixels = gdk_pixbuf_get_pixels (pixbuf);
@@ -146,7 +149,9 @@ gnome_desktop_thumbnail_scale_down_pixbuf (GdkPixbuf *pixbuf,
}
src += source_rowstride;
}
-
+
+ g_assert (n_pixels > 0);
+
if (has_alpha) {
if (a != 0) {
*dest++ = r / a;