]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/scpr: Skip frames which change nothing
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 25 Sep 2018 00:36:35 +0000 (02:36 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 30 Sep 2018 20:23:02 +0000 (22:23 +0200)
Fixes: Timeout
Fixes: 10292/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCPR_fuzzer-5687943864254464
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/scpr.c

index 81597aa4dcf5975e7ea6873a8bfc6e94c0e14bd3..e41fbbec13c7b9051f6589125011a38b6678dd3b 100644 (file)
@@ -516,7 +516,7 @@ static int decompress_p(AVCodecContext *avctx,
     int backstep = linesize - avctx->width;
 
     if (bytestream2_get_byte(gb) == 0)
-        return 0;
+        return 1;
     bytestream2_skip(gb, 1);
     init_rangecoder(&s->rc, gb);
 
@@ -813,6 +813,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
                            s->current_frame->linesize[0] / 4,
                            (uint32_t *)s->last_frame->data[0],
                            s->last_frame->linesize[0] / 4);
+        if (ret == 1)
+            return avpkt->size;
     } else {
         return AVERROR_PATCHWELCOME;
     }