nsxivca7368a
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.
+0 −4
1 file changed
- M image.c +0 −4
| @@ -203,10 +203,6 @@ static bool img_load_gif(img_t *img, const fileinfo_t *file) | |||
| 203 | 203 | ||
| 204 | 204 | ptr = data = emalloc(sw * sh * sizeof(DATA32)); | |
| 205 | 205 | cmap = gif->Image.ColorMap ? gif->Image.ColorMap : gif->SColorMap; | |
| 206 | − | if (bg >= cmap->ColorCount) { | |
| 207 | − | err = true; | |
| 208 | − | break; | |
| 209 | − | } | |
| 210 | 206 | r = cmap->Colors[bg].Red; | |
| 211 | 207 | g = cmap->Colors[bg].Green; | |
| 212 | 208 | b = cmap->Colors[bg].Blue; | |