summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2015-09-21 22:26:52 +0200
committerBenjamin Otte <otte@redhat.com>2015-10-13 02:56:47 +0200
commit6286d5289c772dc8549beb9138fc3cbc5212939c (patch)
tree8396a71a38e6a052f4df201c546dc62052eb3620
parentf9728455ca45fe6fde092c3554d47a8a3d74741c (diff)
downloadgdk-pixbuf-6286d5289c772dc8549beb9138fc3cbc5212939c.tar.gz
tga: Error out if a pseudocolor image comes without colormap
-rw-r--r--gdk-pixbuf/io-tga.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gdk-pixbuf/io-tga.c b/gdk-pixbuf/io-tga.c
index 0f2c10f1e..848b76e6e 100644
--- a/gdk-pixbuf/io-tga.c
+++ b/gdk-pixbuf/io-tga.c
@@ -512,6 +512,17 @@ tga_load_colormap (TGAContext *ctx,
g_bytes_unref (bytes);
}
+ else
+ {
+ if ((ctx->hdr->type == TGA_TYPE_PSEUDOCOLOR)
+ || (ctx->hdr->type == TGA_TYPE_RLE_PSEUDOCOLOR))
+ {
+ g_set_error_literal (err, GDK_PIXBUF_ERROR,
+ GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
+ _("Pseudocolor image does not contain a colormap"));
+ return FALSE;
+ }
+ }
if ((ctx->hdr->type == TGA_TYPE_RLE_PSEUDOCOLOR)
|| (ctx->hdr->type == TGA_TYPE_RLE_TRUECOLOR)