[FFmpeg-cvslog] zmbvdec: Check the buffer size for uncompressed data

Michael Niedermayer git at videolan.org
Thu Jan 16 21:51:29 CET 2014


ffmpeg | branch: release/0.10 | Michael Niedermayer <michaelni at gmx.at> | Sun Nov 11 18:08:39 2012 +0100| [b81d804f2ac113a46d1736751401d78f998db56d] | committer: Luca Barbato

zmbvdec: Check the buffer size for uncompressed data

Also don't pointlessly set the buffer size to 1 after copying
one packet.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable at libav.org
Signed-off-by: Martin Storsjö <martin at martin.st>
(cherry picked from commit 0d61f260010707f3028b818e8b24598e1a83d696)
Signed-off-by: Luca Barbato <lu_zero at gentoo.org>

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

 libavcodec/zmbv.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/zmbv.c b/libavcodec/zmbv.c
index a36a844..9df0d53 100644
--- a/libavcodec/zmbv.c
+++ b/libavcodec/zmbv.c
@@ -497,8 +497,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
      }
 
      if (c->comp == 0) { //Uncompressed data
+         if (c->decomp_size < len) {
+             av_log(avctx, AV_LOG_ERROR, "Buffer too small\n");
+             return AVERROR_INVALIDDATA;
+         }
          memcpy(c->decomp_buf, buf, len);
-         c->decomp_size = 1;
      } else { // ZLIB-compressed data
         c->zstream.total_in = c->zstream.total_out = 0;
         c->zstream.next_in = buf;



More information about the ffmpeg-cvslog mailing list