[MPlayer-cvslog] r21899 - trunk/libmpdemux/demux_gif.c

reimar subversion at mplayerhq.hu
Sat Jan 13 12:06:40 CET 2007


Author: reimar
Date: Sat Jan 13 12:06:40 2007
New Revision: 21899

Modified:
   trunk/libmpdemux/demux_gif.c

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


Modified: trunk/libmpdemux/demux_gif.c
==============================================================================
--- trunk/libmpdemux/demux_gif.c	(original)
+++ trunk/libmpdemux/demux_gif.c	Sat Jan 13 12:06:40 2007
@@ -119,9 +119,11 @@
 
   {
     int y;
+    int cnt = effective_map->ColorCount;
+    if (cnt > 256) cnt = 256;
 
     // 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) + 1] = effective_map->Colors[y].Green;
 	priv->palette[(y * 4) + 2] = effective_map->Colors[y].Red;



More information about the MPlayer-cvslog mailing list