[gtk+/gtk-2-18] Prevent a crash in the TGA loader
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-18] Prevent a crash in the TGA loader
- Date: Fri, 12 Mar 2010 23:03:06 +0000 (UTC)
commit 4623a485c7d2eeffe3ed5d89d1b3359cc8e9f495
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Feb 23 11:50:25 2010 -0500
Prevent a crash in the TGA loader
Reported in bug 609744.
(cherry picked from commit 33330ab332ed1056d965a982a2fdd7adebddac30)
gdk-pixbuf/io-tga.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/gdk-pixbuf/io-tga.c b/gdk-pixbuf/io-tga.c
index e42758c..0391e1e 100644
--- a/gdk-pixbuf/io-tga.c
+++ b/gdk-pixbuf/io-tga.c
@@ -679,7 +679,13 @@ static gboolean try_colormap(TGAContext *ctx, GError **err)
static guint n;
g_return_val_if_fail(ctx != NULL, FALSE);
- g_return_val_if_fail(ctx->cmap_size > 0, TRUE);
+
+ if (ctx->cmap_size == 0) {
+ g_set_error_literal(err, GDK_PIXBUF_ERROR,
+ GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
+ _("Image is corrupted or truncated"));
+ return FALSE;
+ }
ctx->cmap = g_try_malloc(sizeof(TGAColormap));
if (!ctx->cmap) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]