diff mbox series

[FFmpeg-devel,4/5] avformat/mpc8: Check remaining space in mpc8_parse_seektable()

Message ID 20201030215206.1629-4-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/5] avformat/argo_brp: Check block align before use
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished

Commit Message

Michael Niedermayer Oct. 30, 2020, 9:52 p.m. UTC
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@niedermayer.cc>
---
 libavformat/mpc8.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c
index ae5cbc0cbf..96a03ed4fd 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)