[FFmpeg-cvslog] iff: Do not read over the source buffer

Luca Barbato git at videolan.org
Thu Jul 11 11:33:38 CEST 2013


ffmpeg | branch: master | Luca Barbato <lu_zero at gentoo.org> | Sat Jun 29 07:26:48 2013 +0200| [7d65e960c72f36b73ae7fe84f8e427d758e61da9] | committer: Luca Barbato

iff: Do not read over the source buffer

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable at libav.org

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7d65e960c72f36b73ae7fe84f8e427d758e61da9
---

 libavcodec/iff.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/iff.c b/libavcodec/iff.c
index eda42e9..bc878c5 100644
--- a/libavcodec/iff.c
+++ b/libavcodec/iff.c
@@ -289,7 +289,7 @@ static int decode_frame_ilbm(AVCodecContext *avctx,
             }
         }
     } else if (avctx->pix_fmt == AV_PIX_FMT_PAL8 || avctx->pix_fmt == AV_PIX_FMT_GRAY8) { // IFF-PBM
-        for (y = 0; y < avctx->height; y++) {
+        for (y = 0; y < avctx->height && buf < buf_end; y++) {
             uint8_t *row = &s->frame.data[0][y * s->frame.linesize[0]];
             memcpy(row, buf, FFMIN(avctx->width, buf_end - buf));
             buf += avctx->width + (avctx->width % 2); // padding if odd



More information about the ffmpeg-cvslog mailing list