[gdk-pixbuf] png: Initialise the created pixbufs
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdk-pixbuf] png: Initialise the created pixbufs
- Date: Wed, 28 Dec 2016 15:47:05 +0000 (UTC)
commit 1fb2e914cee72ef2401ebb2679fd85c37ae92c69
Author: Bastien Nocera <hadess hadess net>
Date: Wed Dec 28 16:09:02 2016 +0100
png: Initialise the created pixbufs
As we cannot easily detect truncated images when feeding data piecemeal,
initialise the empty image to avoid reading uninitialised memory where
we could not fill the pixbuf.
https://bugzilla.gnome.org/show_bug.cgi?id=696331
gdk-pixbuf/io-png.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/gdk-pixbuf/io-png.c b/gdk-pixbuf/io-png.c
index bb198c9..364d585 100644
--- a/gdk-pixbuf/io-png.c
+++ b/gdk-pixbuf/io-png.c
@@ -325,6 +325,8 @@ gdk_pixbuf__png_image_load (FILE *f, GError **error)
return NULL;
}
+ gdk_pixbuf_fill (pixbuf, DEFAULT_FILL_COLOR);
+
rows = g_new (png_bytep, h);
for (i = 0, ptr = pixbuf->pixels; i < h; i++, ptr = (guchar *) ptr + pixbuf->rowstride)
@@ -689,6 +691,8 @@ png_info_callback (png_structp png_read_ptr,
return;
}
+ gdk_pixbuf_fill (lc->pixbuf, DEFAULT_FILL_COLOR);
+
/* Extract text chunks and attach them as pixbuf options */
if (png_get_text (png_read_ptr, png_info_ptr, &png_text_ptr, &num_texts)) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]