[gdk-pixbuf/wip/otte/tga: 18/24] tga: Error out if a pseudocolor image comes without colormap



commit da70d1cf3904e4914d081cc471a47f2a330ab4d0
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]