# HG changeset patch
# User reimar
# Date 1168688405 0
# Node ID 7484e767c53df02cbd3e18e4788bf93eb335aa19
# Parent  3758ec905220e42c6e02e953186dc3b52d9e9b3c
One more bounds check, though IMO the gif lib really should do this.

diff -r 3758ec905220 -r 7484e767c53d libmpdemux/demux_gif.c
--- 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++) {