kwo pushed a commit to branch master.

http://git.enlightenment.org/legacy/imlib2.git/commit/?id=39641e74a560982fbf93f29bf96b37d27803cb56

commit 39641e74a560982fbf93f29bf96b37d27803cb56
Author: Kim Woelders <k...@woelders.dk>
Date:   Tue Dec 31 17:50:18 2013 +0100

    GIF loader: Fix segv on images without colormap.
    
    Not sure what is the proper way to handle this.
    For now we just fill the image with zeros.
---
 src/modules/loaders/loader_gif.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/modules/loaders/loader_gif.c b/src/modules/loaders/loader_gif.c
index 69de9dc..be10478 100644
--- a/src/modules/loaders/loader_gif.c
+++ b/src/modules/loaders/loader_gif.c
@@ -142,6 +142,14 @@ load(ImlibImage * im, ImlibProgressFunction progress, char 
progress_granularity,
         if (!im->data)
            goto quit;
 
+        if (!cmap)
+          {
+             /* No colormap? Now what?? Let's clear the image (and not segv) */
+             memset(im->data, 0, sizeof(DATA32) * w * h);
+             rc = 1;
+             goto finish;
+          }
+
         ptr = im->data;
         per_inc = 100.0 / (((float)w) * h);
         for (i = 0; i < h; i++)
@@ -177,6 +185,7 @@ load(ImlibImage * im, ImlibProgressFunction progress, char 
progress_granularity,
                }
           }
 
+      finish:
         if (progress)
            progress(im, 100, 0, last_y, w, h);
      }

-- 


Reply via email to