[gnome-directory-thumbnailer] core: Bail early if scaled pixbuf dimensions are zero
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-directory-thumbnailer] core: Bail early if scaled pixbuf dimensions are zero
- Date: Sun, 30 Apr 2017 09:20:01 +0000 (UTC)
commit d121aea4a0c014e26b8758697adcb2e9f5bc0178
Author: Philip Withnall <philip tecnocode co uk>
Date: Sun Apr 30 10:12:27 2017 +0100
core: Bail early if scaled pixbuf dimensions are zero
This is possible if the input image is huge in one dimension and tiny in
the other, leading to a very small scale factor.
Signed-off-by: Philip Withnall <philip tecnocode co uk>
src/main.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/src/main.c b/src/main.c
index f0c2364..133a7ea 100644
--- a/src/main.c
+++ b/src/main.c
@@ -571,6 +571,11 @@ main (int argc, char *argv[])
g_debug ("Scaling thumbnail from %u×%u to %u×%u with for output size %i with scaling
factor %f.",
original_width, original_height, scaled_width, scaled_height, output_size,
scale);
+ if (scaled_width == 0 || scaled_height == 0) {
+ status = STATUS_ERROR_GENERATING_THUMBNAIL;
+ goto done;
+ }
+
scaled_pixbuf = gnome_desktop_thumbnail_scale_down_pixbuf (pixbuf, scaled_width,
scaled_height);
g_object_unref (pixbuf);
pixbuf = scaled_pixbuf; /* transfer ownership */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]