dloebl / cgif

GIF encoder written in C

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LCT bounds check is probably incorrect.

srijan-paul opened this issue · comments

EDIT: Bad report

I was setting the palette color count incorrectly (size of the buffer instead of number of 3 tuples in it). Excuse my ignorance.

Here, in cgif_raw.c, there is a bounds check that requires the LCT size to be lower than 256. However, the LCT is a RGBRGBRGB... buffer. So for N colors, there will be 3*N entries.

Meaning, for 100 colors—which is less than the maximum of 256 that the GIF format allows—the buffer will have a size of 300, and therefore fail the bounds check.

This seems like an oversight, but I wanted to confirm before forking the repo.