From ca7368aa8960ee6b7094b997dcc71ffb5b1e310f Mon Sep 17 00:00:00 2001 From: NRK Date: Wed, 17 Nov 2021 05:46:02 +0600 Subject: [PATCH] Revert "fix: out-of-bounds access when bg not in color map" with this patch certain gif images will fail to play. one other problem here is that it suddenly breaks the loop without free-ing data and rows, leading to a memory leak. regardless, this needs to be investigated further. here's an example image where this happens: https://i.postimg.cc/SQf1TJJg/awoo-study.gif This reverts commit cca7834e6718c6ff64da42ed5e9770880a3e8ff6. --- image.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/image.c b/image.c index 9a47a14..980bf1a 100644 --- a/image.c +++ b/image.c @@ -203,10 +203,6 @@ static bool img_load_gif(img_t *img, const fileinfo_t *file) ptr = data = emalloc(sw * sh * sizeof(DATA32)); cmap = gif->Image.ColorMap ? gif->Image.ColorMap : gif->SColorMap; - if (bg >= cmap->ColorCount) { - err = true; - break; - } r = cmap->Colors[bg].Red; g = cmap->Colors[bg].Green; b = cmap->Colors[bg].Blue;