Fix invalid read for gifs with a palette for less than 256 colors

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21899 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2007-01-13 11:06:40 +00:00
parent 6a2c85c59c
commit eb2b0bc2a7
1 changed files with 3 additions and 1 deletions

View File

@ -119,9 +119,11 @@ static int demux_gif_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds)
{ {
int y; int y;
int cnt = effective_map->ColorCount;
if (cnt > 256) cnt = 256;
// copy the palette // copy the palette
for (y = 0; y < 256; y++) { for (y = 0; y < cnt; y++) {
priv->palette[(y * 4) + 0] = effective_map->Colors[y].Blue; priv->palette[(y * 4) + 0] = effective_map->Colors[y].Blue;
priv->palette[(y * 4) + 1] = effective_map->Colors[y].Green; priv->palette[(y * 4) + 1] = effective_map->Colors[y].Green;
priv->palette[(y * 4) + 2] = effective_map->Colors[y].Red; priv->palette[(y * 4) + 2] = effective_map->Colors[y].Red;