Mercurial > libavformat.hg
changeset 507:f998b32632d6 libavformat
* fixing a buffer overrun in gif.c
author | romansh |
---|---|
date | Wed, 28 Jul 2004 21:56:59 +0000 |
parents | 74ad3aa6749c |
children | 4655d19a3d94 |
files | gif.c |
diffstat | 1 files changed, 3 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/gif.c Wed Jul 28 10:04:14 2004 +0000 +++ b/gif.c Wed Jul 28 21:56:59 2004 +0000 @@ -252,7 +252,7 @@ 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 @@ 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; }