]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/fic: Check input size against minimal frame size
authorMichael Niedermayer <michael@niedermayer.cc>
Wed, 1 May 2019 18:12:12 +0000 (20:12 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 9 May 2019 20:07:26 +0000 (22:07 +0200)
Fixes: Timeout (22sec ->54ms)
Fixes: 14439/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FIC_fuzzer-5660988231122944
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/fic.c

index 65d102b86bea25f8bdc982889c50b2277342710b..540078eda1292e52e66b6bf456cf0fba55d6868b 100644 (file)
@@ -356,7 +356,7 @@ static int fic_decode_frame(AVCodecContext *avctx, void *data,
     sdata = src + tsize + FIC_HEADER_SIZE + 4 * nslices;
     msize = avpkt->size - nslices * 4 - tsize - FIC_HEADER_SIZE;
 
-    if (msize <= 0) {
+    if (msize <= ctx->aligned_width/8 * (ctx->aligned_height/8) / 8) {
         av_log(avctx, AV_LOG_ERROR, "Not enough frame data to decode.\n");
         return AVERROR_INVALIDDATA;
     }