aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorRoman Shaposhnik <roman@shaposhnik.org>2004-07-28 21:56:59 +0000
committerRoman Shaposhnik <roman@shaposhnik.org>2004-07-28 21:56:59 +0000
commitf5fc28d23c46d334c809c11d62651d0080f1c325 (patch)
tree917ee6a906b9a4a8b39f0c0e6f96915ed6e2941d /libavformat
parent668fe04e39391d88216985742f747432526d7707 (diff)
downloadffmpeg-f5fc28d23c46d334c809c11d62651d0080f1c325.tar.gz
* 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.c8
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;
}