From d359f1537cd8ef9b7b0d22b001a196a47c012bc7 Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 13 Jan 2007 11:40:05 +0000 Subject: One more bounds check, though IMO the gif lib really should do this. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21902 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/demux_gif.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'libmpdemux/demux_gif.c') diff --git a/libmpdemux/demux_gif.c b/libmpdemux/demux_gif.c index e36514bb8b..af1087f5ab 100644 --- a/libmpdemux/demux_gif.c +++ b/libmpdemux/demux_gif.c @@ -121,10 +121,10 @@ static int demux_gif_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds) { 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++) { -- cgit v1.2.3