[gdk-pixbuf] ico: Return an error when the ICO didn't load
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdk-pixbuf] ico: Return an error when the ICO didn't load
- Date: Thu, 27 Jul 2017 12:34:57 +0000 (UTC)
commit 758655315bc3760c2d646e1e935f7448847073af
Author: Bastien Nocera <hadess hadess net>
Date: Thu Jul 27 13:27:47 2017 +0100
ico: Return an error when the ICO didn't load
If we don't even read enough data to fill the header, return an
error. This doesn't cover everything that could go wrong with
the ICO incremental loader, but this is a good first throw.
https://bugzilla.gnome.org/show_bug.cgi?id=778204
gdk-pixbuf/io-ico.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/gdk-pixbuf/io-ico.c b/gdk-pixbuf/io-ico.c
index 5b3646c..32e4c69 100644
--- a/gdk-pixbuf/io-ico.c
+++ b/gdk-pixbuf/io-ico.c
@@ -610,6 +610,7 @@ gdk_pixbuf__ico_image_stop_load(gpointer data,
{
struct ico_progressive_state *context =
(struct ico_progressive_state *) data;
+ gboolean ret = TRUE;
/* FIXME this thing needs to report errors if
* we have unused image data
@@ -617,8 +618,16 @@ gdk_pixbuf__ico_image_stop_load(gpointer data,
g_return_val_if_fail(context != NULL, TRUE);
+ if (context->HeaderDone < context->HeaderSize) {
+ g_set_error_literal (error,
+ GDK_PIXBUF_ERROR,
+ GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
+ _("ICO image was truncated or incomplete."));
+ ret = FALSE;
+ }
+
context_free (context);
- return TRUE;
+ return ret;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]