Browse code

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 d3b25383daffac154846daeb4e4fb46569e728db)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2015/03/11 04:21:14
Showing 1 changed files
... ...
@@ -45,8 +45,8 @@ static int zero12v_decode_frame(AVCodecContext *avctx, void *data,
45 45
     const uint8_t *line_end, *src = avpkt->data;
46 46
     int stride = avctx->width * 8 / 3;
47 47
 
48
-    if (width == 1) {
49
-        av_log(avctx, AV_LOG_ERROR, "Width 1 not supported.\n");
48
+    if (width <= 1 || avctx->height <= 0) {
49
+        av_log(avctx, AV_LOG_ERROR, "Dimensions %dx%d not supported.\n", width, avctx->height);
50 50
         return AVERROR_INVALIDDATA;
51 51
     }
52 52