Code: Select all
@@ -264,7 +264,7 @@ static Image *ReadTGAImage(const ImageIn
if (image->storage_class == PseudoClass)
{
if (tga_info.colormap_type != 0)
- image->colors=tga_info.colormap_length;
+ image->colors=tga_info.colormap_index+tga_info.colormap_length;
else
{
size_t
@@ -316,7 +316,9 @@ static Image *ReadTGAImage(const ImageIn
*/
if (AcquireImageColormap(image,image->colors,exception) == MagickFalse)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
- for (i=0; i < (ssize_t) image->colors; i++)
+ for (i=0; i < (ssize_t) image->tga_info.colormap_index; i++)
+ image->colormap[i]=pixel;
+ for (i=(ssize_t) tga_info.colormap_index; i < (ssize_t) image->colors; i++)
{
switch (tga_info.colormap_size)
{