diff options
author | whowillbellthecat <everythingisbotnet@protonmail.com> | 2021-09-13 22:24:40 +0600 |
---|---|---|
committer | Berke Kocaoğlu <berke.kocaoglu@metu.edu.tr> | 2021-09-16 22:55:31 +0300 |
commit | cca7834e6718c6ff64da42ed5e9770880a3e8ff6 (patch) | |
tree | 2223aced2684f847d32cef8170545d7a558f6700 | |
parent | cbec6991c21771f75dfa81b14f31bf17f634bfed (diff) |
fix: out-of-bounds access when bg not in color map
-rw-r--r-- | image.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -205,6 +205,10 @@ bool img_load_gif(img_t *img, const fileinfo_t *file) ptr = data = (DATA32*) emalloc(sizeof(DATA32) * sw * sh); 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; |