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>
(cherry picked from commit 0d61f26001
)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
This commit is contained in:

committed by
Luca Barbato

parent
eba112b4e3
commit
9e505065b5
@@ -508,8 +508,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (c->comp == 0) { //Uncompressed data
|
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);
|
memcpy(c->decomp_buf, buf, len);
|
||||||
c->decomp_size = 1;
|
|
||||||
} else { // ZLIB-compressed data
|
} else { // ZLIB-compressed data
|
||||||
c->zstream.total_in = c->zstream.total_out = 0;
|
c->zstream.total_in = c->zstream.total_out = 0;
|
||||||
c->zstream.next_in = buf;
|
c->zstream.next_in = buf;
|
||||||
|
Reference in New Issue
Block a user