From 1c031ad24bf3d78b34f21cecd696e55c145007ce Mon Sep 17 00:00:00 2001 From: morkt Date: Fri, 13 Nov 2015 11:41:52 +0400 Subject: [PATCH] (TgaFormat.ReadMetaData): additional sanity check for color-mapped images. --- GameRes/ImageTGA.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/GameRes/ImageTGA.cs b/GameRes/ImageTGA.cs index dad7ad3b..d6dec3ed 100644 --- a/GameRes/ImageTGA.cs +++ b/GameRes/ImageTGA.cs @@ -142,15 +142,18 @@ namespace GameRes { default: return null; case 1: // Uncompressed, color-mapped images. - case 2: // Uncompressed, RGB images. - case 3: // Uncompressed, black and white images. case 9: // Runlength encoded color-mapped images. - case 10: // Runlength encoded RGB images. - case 11: // Compressed, black and white images. case 32: // Compressed color-mapped data, using Huffman, Delta, and // runlength encoding. case 33: // Compressed color-mapped data, using Huffman, Delta, and // runlength encoding. 4-pass quadtree-type process. + if (colormap_depth != 24 && colormap_depth != 32) + return null; + break; + case 2: // Uncompressed, RGB images. + case 3: // Uncompressed, black and white images. + case 10: // Runlength encoded RGB images. + case 11: // Compressed, black and white images. break; } return new TgaMetaData {