avcodec/012v: Check dimensions more completely

Fixes division by 0

Found-by: Thomas Lindroth <thomas.lindroth@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d3b25383da)

Conflicts:

	libavcodec/012v.c
This commit is contained in:
Michael Niedermayer
2015-03-10 20:21:14 +01:00
parent 9e835572f8
commit 9f650fb5fb

View File

@@ -54,8 +54,8 @@ static int zero12v_decode_frame(AVCodecContext *avctx, void *data,
if (pic->data[0]) if (pic->data[0])
avctx->release_buffer(avctx, pic); avctx->release_buffer(avctx, pic);
if (width == 1) { if (width <= 1 || avctx->height <= 0) {
av_log(avctx, AV_LOG_ERROR, "Width 1 not supported.\n"); av_log(avctx, AV_LOG_ERROR, "Dimensions %dx%d not supported.\n", width, avctx->height);
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
if (avpkt->size < avctx->height * stride) { if (avpkt->size < avctx->height * stride) {