[FFmpeg-cvslog] avcodec/scpr: check remaining data after decode

Michael Niedermayer git at videolan.org
Fri May 10 00:38:51 EEST 2019


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Thu Apr 25 20:23:26 2019 +0200| [6dd8420290ef79945ec33e65fc3751e6e0bd9433] | committer: Michael Niedermayer

avcodec/scpr: check remaining data after decode

Fixes Timeout (29sec -> 14sec)
Fixes: 13713/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCPR_fuzzer-5756778069884928

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6dd8420290ef79945ec33e65fc3751e6e0bd9433
---

 libavcodec/scpr.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/scpr.c b/libavcodec/scpr.c
index ce614ffacf..10fc994ecf 100644
--- a/libavcodec/scpr.c
+++ b/libavcodec/scpr.c
@@ -575,6 +575,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
     if (ret < 0)
         return ret;
 
+    if (bytestream2_get_bytes_left(gb) > 5)
+        return AVERROR_INVALIDDATA;
+
     if (avctx->bits_per_coded_sample != 16) {
         ret = av_frame_ref(data, s->current_frame);
         if (ret < 0)



More information about the ffmpeg-cvslog mailing list