avcodec/ulti: Check number of blocks at init
authorMichael Niedermayer <michael@niedermayer.cc>
Mon, 15 Jan 2018 18:03:48 +0000 (19:03 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 12 Apr 2018 22:35:15 +0000 (00:35 +0200)
Fixes: Timeout
Fixes: 4832/clusterfuzz-testcase-4699096590843904

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 725353525e73bbe5b6b4d01528252675f2417a02)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/ulti.c

index e6f4374..9e4c088 100644 (file)
@@ -50,6 +50,8 @@ static av_cold int ulti_decode_init(AVCodecContext *avctx)
     s->width = avctx->width;
     s->height = avctx->height;
     s->blocks = (s->width / 8) * (s->height / 8);
+    if (s->blocks == 0)
+        return AVERROR_INVALIDDATA;
     avctx->pix_fmt = AV_PIX_FMT_YUV410P;
     s->ulti_codebook = ulti_codebook;