From e74968f8ef28b7d1ae3957c278e0fe5af77e7b56 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 13 Oct 2008 14:18:40 +0000 Subject: [PATCH] =?UTF-8?q?Bug=20555791=20=E2=80=93=20Natuilus=20Crashes?= =?UTF-8?q?=20when=20opening=20USB=20MP3=20Player=20Contents?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2008-10-13 Matthias Clasen Bug 555791 – Natuilus Crashes when opening USB MP3 Player Contents * io-tga.c (gdk_pixbuf__tga_stop_load): Don't segfault on short files. Problem reported by Pedro Villavicencio svn path=/trunk/; revision=21643 --- gdk-pixbuf/ChangeLog | 8 ++++++++ gdk-pixbuf/io-tga.c | 8 +++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog index 650ca00d41..4d88a4359e 100644 --- a/gdk-pixbuf/ChangeLog +++ b/gdk-pixbuf/ChangeLog @@ -1,3 +1,11 @@ +2008-10-13 Matthias Clasen + + Bug 555791 – Natuilus Crashes when opening USB MP3 Player Contents + + * io-tga.c (gdk_pixbuf__tga_stop_load): Don't segfault on + short files. + Problem reported by Pedro Villavicencio + 2008-10-01 Tor Lillqvist * io-icns.c: Don't #define _GNU_SOURCE on Windows as it confuses diff --git a/gdk-pixbuf/io-tga.c b/gdk-pixbuf/io-tga.c index c35eaef916..e42758c198 100644 --- a/gdk-pixbuf/io-tga.c +++ b/gdk-pixbuf/io-tga.c @@ -349,7 +349,7 @@ static gboolean fill_in_context(TGAContext *ctx, GError **err) } ctx->pbuf_bytes = ctx->pbuf->rowstride * ctx->pbuf->height; - if (ctx->hdr->flags & TGA_ORIGIN_UPPER || ctx->run_length_encoded) + if ((ctx->hdr->flags & TGA_ORIGIN_UPPER) || ctx->run_length_encoded) ctx->pptr = ctx->pbuf->pixels; else ctx->pptr = ctx->pbuf->pixels + (ctx->pbuf->height - 1)*ctx->pbuf->rowstride; @@ -935,8 +935,10 @@ static gboolean gdk_pixbuf__tga_stop_load(gpointer data, GError **err) TGAContext *ctx = (TGAContext *) data; g_return_val_if_fail(ctx != NULL, FALSE); - if (!(ctx->hdr->flags & TGA_ORIGIN_UPPER) && - ctx->run_length_encoded && ctx->pbuf) { + if (ctx->hdr && + (ctx->hdr->flags & TGA_ORIGIN_UPPER) == 0 && + ctx->run_length_encoded && + ctx->pbuf) { pixbuf_flip_vertically (ctx->pbuf); if (ctx->ufunc) (*ctx->ufunc) (ctx->pbuf, 0, 0,