diff options
author | Roman Shaposhnik <roman@shaposhnik.org> | 2004-07-29 01:56:59 +0400 |
---|---|---|
committer | Roman Shaposhnik <roman@shaposhnik.org> | 2004-07-29 01:56:59 +0400 |
commit | f5fc28d23c46d334c809c11d62651d0080f1c325 (patch) | |
tree | 917ee6a906b9a4a8b39f0c0e6f96915ed6e2941d /libavformat | |
parent | 668fe04e39391d88216985742f747432526d7707 (diff) |
* fixing a buffer overrun in gif.c
Originally committed as revision 3363 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/gif.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/libavformat/gif.c b/libavformat/gif.c index 3a5f041e61..84809bf659 100644 --- a/libavformat/gif.c +++ b/libavformat/gif.c @@ -252,7 +252,7 @@ static int gif_image_write_image(ByteIOContext *pb, gif_put_bits_rev(&p, 9, 0x0100); /* clear code */ - for(i=0;i<GIF_CHUNKS;i++) { + for(i=(left<GIF_CHUNKS)?left:GIF_CHUNKS;i;i--) { if (pix_fmt == PIX_FMT_RGB24) { v = gif_clut_index(ptr[0], ptr[1], ptr[2]); ptr+=3; @@ -276,12 +276,10 @@ static int gif_image_write_image(ByteIOContext *pb, put_buffer(pb, p.buf, pbBufPtr(&p) - p.buf); /* the actual buffer */ p.buf_ptr = p.buf; /* dequeue the bytes off the bitstream */ } - if(left<=GIF_CHUNKS) { - put_byte(pb, 0x00); /* end of image block */ - } - left-=GIF_CHUNKS; } + put_byte(pb, 0x00); /* end of image block */ + return 0; } |