raster pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=db4ff548d356243638f5fa0898b2ee4ff1be55f5

commit db4ff548d356243638f5fa0898b2ee4ff1be55f5
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
Date:   Mon Apr 4 09:51:12 2016 +0900

    evas - gif loader - handle missing colormap
    
    follow on from dd90b6afadf706aafec9e53a6b1efa8f899ab277 - this handled
    if a gif file has no colormap (it'll decode as blank now as a colormap
    of all 0's is used instead).
    
    @fix
---
 .../evas/image_loaders/gif/evas_image_load_gif.c   | 30 ++++++++++++++--------
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/src/modules/evas/image_loaders/gif/evas_image_load_gif.c 
b/src/modules/evas/image_loaders/gif/evas_image_load_gif.c
index 09d3b27..ac40352 100644
--- a/src/modules/evas/image_loaders/gif/evas_image_load_gif.c
+++ b/src/modules/evas/image_loaders/gif/evas_image_load_gif.c
@@ -128,11 +128,16 @@ _fill_frame(DATA32 *data, int rowpix, GifFileType *gif, 
Frame_Info *finfo,
         else cmap = gif->SColorMap;
         bg = gif->SBackGroundColor;
 
-        // fill in local color table of guaranteed 256 entires with cmap & pad
-        for (cnum = 0; cnum < cmap->ColorCount; cnum++)
-          colors[cnum] = cmap->Colors[cnum];
-        for (cnum = cmap->ColorCount; cnum < 256; cnum++)
-          colors[cnum] = cmap->Colors[0];
+        if (cmap)
+          {
+             // fill in local color table of guaranteed 256 with cmap & pad
+             for (cnum = 0; cnum < cmap->ColorCount; cnum++)
+               colors[cnum] = cmap->Colors[cnum];
+             for (cnum = cmap->ColorCount; cnum < 256; cnum++)
+               colors[cnum] = cmap->Colors[0];
+          }
+        else
+          memset(colors, 0, sizeof(colors));
         // and do the fill
         _fill_image
           (data, rowpix,
@@ -258,11 +263,16 @@ _decode_image(GifFileType *gif, DATA32 *data, int rowpix, 
int xin, int yin,
    if (gif->Image.ColorMap) cmap = gif->Image.ColorMap;
    else cmap = gif->SColorMap;
 
-   // fill in local color table of guaranteed 256 entires with cmap & pad
-   for (cnum = 0; cnum < cmap->ColorCount; cnum++)
-     colors[cnum] = cmap->Colors[cnum];
-   for (cnum = cmap->ColorCount; cnum < 256; cnum++)
-     colors[cnum] = cmap->Colors[0];
+   if (cmap)
+     {
+        // fill in local color table of guaranteed 256 entires with cmap & pad
+        for (cnum = 0; cnum < cmap->ColorCount; cnum++)
+          colors[cnum] = cmap->Colors[cnum];
+        for (cnum = cmap->ColorCount; cnum < 256; cnum++)
+          colors[cnum] = cmap->Colors[0];
+     }
+   else
+     memset(colors, 0, sizeof(colors));
    // if we need to deal with transparent pixels at all...
    if (transparent >= 0)
      {

-- 


Reply via email to