fix: out-of-bounds access when bg not in color map
This commit is contained in:
parent
cbec6991c2
commit
cca7834e67
4
image.c
4
image.c
|
@ -205,6 +205,10 @@ bool img_load_gif(img_t *img, const fileinfo_t *file)
|
||||||
|
|
||||||
ptr = data = (DATA32*) emalloc(sizeof(DATA32) * sw * sh);
|
ptr = data = (DATA32*) emalloc(sizeof(DATA32) * sw * sh);
|
||||||
cmap = gif->Image.ColorMap ? gif->Image.ColorMap : gif->SColorMap;
|
cmap = gif->Image.ColorMap ? gif->Image.ColorMap : gif->SColorMap;
|
||||||
|
if (bg >= cmap->ColorCount) {
|
||||||
|
err = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
r = cmap->Colors[bg].Red;
|
r = cmap->Colors[bg].Red;
|
||||||
g = cmap->Colors[bg].Green;
|
g = cmap->Colors[bg].Green;
|
||||||
b = cmap->Colors[bg].Blue;
|
b = cmap->Colors[bg].Blue;
|
||||||
|
|
Loading…
Reference in New Issue