changeset 21884:7484e767c53d

One more bounds check, though IMO the gif lib really should do this.
author reimar
date Sat, 13 Jan 2007 11:40:05 +0000
parents 3758ec905220
children d885d65e8dc8
files libmpdemux/demux_gif.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_gif.c	Sat Jan 13 11:37:59 2007 +0000
+++ b/libmpdemux/demux_gif.c	Sat Jan 13 11:40:05 2007 +0000
@@ -121,10 +121,10 @@
   {
     int y;
     int cnt = FFMIN(effective_map->ColorCount, 256);
-    int l = FFMIN(gif->Image.Left, priv->w);
-    int t = FFMIN(gif->Image.Top, priv->h);
-    int w = FFMIN(gif->Image.Width, priv->w - l);
-    int h = FFMIN(gif->Image.Height, priv->h - t);
+    int l = FFMAX(FFMIN(gif->Image.Left, priv->w), 0);
+    int t = FFMAX(FFMIN(gif->Image.Top, priv->h), 0);
+    int w = FFMAX(FFMIN(gif->Image.Width, priv->w - l), 0);
+    int h = FFMAX(FFMIN(gif->Image.Height, priv->h - t), 0);
 
     // copy the palette
     for (y = 0; y < cnt; y++) {