[gdk-pixbuf] png: Return error for truncated PNG files
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdk-pixbuf] png: Return error for truncated PNG files
- Date: Wed, 22 Oct 2014 12:33:02 +0000 (UTC)
commit 447bd32650af6be56993c474d3ad64d58cc0a7d2
Author: Felix Riemann <friemann gnome org>
Date: Wed Aug 27 10:59:00 2008 +0000
png: Return error for truncated PNG files
When a PNG image couldn't be loaded at the end of a progressive
load operation, throw an error.
The error string is already translated as part of the BMP and
PNM loaders.
https://bugzilla.gnome.org/show_bug.cgi?id=524216
gdk-pixbuf/io-png.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/gdk-pixbuf/io-png.c b/gdk-pixbuf/io-png.c
index 83e46ff..ae0fafe 100644
--- a/gdk-pixbuf/io-png.c
+++ b/gdk-pixbuf/io-png.c
@@ -496,6 +496,7 @@ static gboolean
gdk_pixbuf__png_image_stop_load (gpointer context, GError **error)
{
LoadContext* lc = context;
+ gboolean retval = TRUE;
g_return_val_if_fail(lc != NULL, TRUE);
@@ -505,11 +506,19 @@ gdk_pixbuf__png_image_stop_load (gpointer context, GError **error)
if (lc->pixbuf)
g_object_unref (lc->pixbuf);
+ else {
+ if (error && *error == NULL) {
+ g_set_error_literal (error, GDK_PIXBUF_ERROR,
+ GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
+ _("Premature end-of-file encountered"));
+ }
+ retval = FALSE;
+ }
png_destroy_read_struct(&lc->png_read_ptr, &lc->png_info_ptr, NULL);
g_free(lc);
- return TRUE;
+ return retval;
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]