diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-11-11 18:08:39 +0100 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2013-09-12 10:53:39 +0300 |
commit | 0d61f260010707f3028b818e8b24598e1a83d696 (patch) | |
tree | 862eda1e3c3134cc3283802914bba8a312758ddc | |
parent | 183b9d843a9533774fabd3984a52f3987001acbc (diff) | |
download | ffmpeg-0d61f260010707f3028b818e8b24598e1a83d696.tar.gz |
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@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
-rw-r--r-- | libavcodec/zmbv.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/zmbv.c b/libavcodec/zmbv.c index 0b38926bc8..65fa5ffece 100644 --- a/libavcodec/zmbv.c +++ b/libavcodec/zmbv.c @@ -499,8 +499,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, 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; |