[gdk-pixbuf] tga: Error out if a pseudocolor image comes without colormap



commit 6286d5289c772dc8549beb9138fc3cbc5212939c
Author: Benjamin Otte <otte redhat com>
Date:   Mon Sep 21 22:26:52 2015 +0200

    tga: Error out if a pseudocolor image comes without colormap

 gdk-pixbuf/io-tga.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/gdk-pixbuf/io-tga.c b/gdk-pixbuf/io-tga.c
index 0f2c10f..848b76e 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)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]