[gnome-color-manager] Fix gcm_utils_image_convert() to not crash for large images
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Fix gcm_utils_image_convert() to not crash for large images
- Date: Mon, 28 Apr 2014 09:53:07 +0000 (UTC)
commit 2b609341144b86c2f786b60e996a742289d50f8c
Author: Richard Hughes <richard hughsie com>
Date: Fri Apr 4 19:05:59 2014 +0200
Fix gcm_utils_image_convert() to not crash for large images
gdk_pixbuf_get_rowstride() returns the number of bytes, cd_transform_process()
expects the number of pixels.
src/gcm-utils.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/src/gcm-utils.c b/src/gcm-utils.c
index 72ab0b8..d2ce95b 100644
--- a/src/gcm-utils.c
+++ b/src/gcm-utils.c
@@ -380,6 +380,7 @@ gcm_utils_image_convert (GtkImage *image,
GdkPixbuf *original_pixbuf;
gboolean ret = TRUE;
guchar *data;
+ guint bpp;
/* get pixbuf */
pixbuf = gtk_image_get_pixbuf (image);
@@ -422,12 +423,13 @@ gcm_utils_image_convert (GtkImage *image,
cd_transform_set_rendering_intent (transform, CD_RENDERING_INTENT_PERCEPTUAL);
cd_transform_set_input_pixel_format (transform, pixel_format);
cd_transform_set_output_pixel_format (transform, pixel_format);
+ bpp = gdk_pixbuf_get_rowstride (pixbuf) / gdk_pixbuf_get_width (pixbuf);
ret = cd_transform_process (transform,
gdk_pixbuf_get_pixels (original_pixbuf),
gdk_pixbuf_get_pixels (pixbuf),
gdk_pixbuf_get_width (pixbuf),
gdk_pixbuf_get_height (pixbuf),
- gdk_pixbuf_get_rowstride (pixbuf),
+ gdk_pixbuf_get_rowstride (pixbuf) / bpp,
NULL,
error);
if (!ret)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]