[FFmpeg-cvslog] avformat/mpc8: Check remaining space in mpc8_parse_seektable()

Michael Niedermayer git at videolan.org
Sat Dec 5 01:11:43 EET 2020


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Fri Oct 30 21:50:32 2020 +0100| [4f66dd13d08d063e2748d172239df595078ff624] | committer: Michael Niedermayer

avformat/mpc8: Check remaining space in mpc8_parse_seektable()

Fixes: Fixes infinite loop
Fixes: 26704/clusterfuzz-testcase-minimized-ffmpeg_dem_MPC8_fuzzer-6327056939614208

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=4f66dd13d08d063e2748d172239df595078ff624
---

 libavformat/mpc8.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c
index a7ad908ca4..447a8d4fdf 100644
--- a/libavformat/mpc8.c
+++ b/libavformat/mpc8.c
@@ -178,6 +178,10 @@ static void mpc8_parse_seektable(AVFormatContext *s, int64_t off)
         av_add_index_entry(s->streams[0], pos, i, 0, 0, AVINDEX_KEYFRAME);
     }
     for(; i < size; i++){
+        if (get_bits_left(&gb) < 13) {
+            av_free(buf);
+            return;
+        }
         t = get_unary(&gb, 1, 33) << 12;
         t += get_bits(&gb, 12);
         if(t & 1)



More information about the ffmpeg-cvslog mailing list