[gdk-pixbuf] thumbnailer: Update from gnome-thumbnailer-skeleton master
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdk-pixbuf] thumbnailer: Update from gnome-thumbnailer-skeleton master
- Date: Tue, 7 Feb 2017 11:28:19 +0000 (UTC)
commit ab921f069d2624de547c9a15252fb278de2baf13
Author: Philip Withnall <philip tecnocode co uk>
Date: Sat Jan 7 17:03:34 2017 +0000
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
thumbnailer/gnome-thumbnailer-skeleton.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/thumbnailer/gnome-thumbnailer-skeleton.c b/thumbnailer/gnome-thumbnailer-skeleton.c
index 10b8d73..d686432 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]