summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2015-09-20 00:29:59 +0200
committerBenjamin Otte <otte@redhat.com>2015-09-20 00:29:59 +0200
commit6ddca835100107e6b5841ce9d56074f6d98c387e (patch)
treec8f3c932b720a4b0e55d2f9a117ae78c6df38338
parentedf6fb8d856574bc3bb3a703037f56533229267c (diff)
downloadgdk-pixbuf-6ddca835100107e6b5841ce9d56074f6d98c387e.tar.gz
io-tga: Colormaps are always present, so always parse them.
We might end up with a colormap with 0 entries, but whatever, it's a colormap.
-rw-r--r--gdk-pixbuf/io-tga.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/gdk-pixbuf/io-tga.c b/gdk-pixbuf/io-tga.c
index 70d18920b..156a41688 100644
--- a/gdk-pixbuf/io-tga.c
+++ b/gdk-pixbuf/io-tga.c
@@ -356,9 +356,8 @@ static gboolean fill_in_context(TGAContext *ctx, GError **err)
|| (ctx->hdr->type == TGA_TYPE_RLE_TRUECOLOR)
|| (ctx->hdr->type == TGA_TYPE_RLE_GRAYSCALE));
- if (ctx->hdr->has_cmap)
- ctx->cmap_size = ((ctx->hdr->cmap_bpp + 7) >> 3) *
- LE16(ctx->hdr->cmap_n_colors);
+ ctx->cmap_size = ((ctx->hdr->cmap_bpp + 7) >> 3) *
+ LE16(ctx->hdr->cmap_n_colors);
alpha = ((ctx->hdr->bpp == 16) ||
(ctx->hdr->bpp == 32) ||
@@ -717,13 +716,6 @@ static gboolean try_colormap(TGAContext *ctx, GError **err)
g_return_val_if_fail(ctx != NULL, FALSE);
- 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;
- }
-
n_colors = LE16(ctx->hdr->cmap_n_colors);
ctx->cmap = colormap_new (n_colors);
if (!ctx->cmap) {
@@ -865,7 +857,7 @@ static gboolean try_preload(TGAContext *ctx, GError **err)
return TRUE;
}
}
- if (ctx->hdr->has_cmap && !ctx->cmap) {
+ if (!ctx->cmap) {
if (ctx->in->size >= ctx->cmap_size) {
if (!try_colormap(ctx, err))
return FALSE;