[FFmpeg-cvslog] zmbvdec: check decompression buffer size.

Michael Niedermayer git at videolan.org
Sun Nov 11 18:22:20 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Nov 11 18:08:39 2012 +0100| [44c23aa1b85d195db6647d24e3b1d3de051790db] | committer: Michael Niedermayer

zmbvdec: check decompression buffer size.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

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

diff --git a/libavcodec/zmbv.c b/libavcodec/zmbv.c
index 762d572..8727bfc 100644
--- a/libavcodec/zmbv.c
+++ b/libavcodec/zmbv.c
@@ -502,8 +502,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, "decomp 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 = (uint8_t*)buf;



More information about the ffmpeg-cvslog mailing list