]> git.sesse.net Git - ffmpeg/commitdiff
avformat/aadec: Check for EOF while reading chapters
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 12 Dec 2020 21:19:22 +0000 (22:19 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Mon, 1 Mar 2021 19:19:15 +0000 (20:19 +0100)
Fixes: timeout
Fixes: 28199/clusterfuzz-testcase-minimized-ffmpeg_dem_AA_fuzzer-4896162657861632
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/aadec.c

index 63f8176a570efaefc43b23d1cc35e6c5e7de18ce..612e66906dea89c8773330086f9700a462d66efd 100644 (file)
@@ -223,7 +223,8 @@ static int aa_read_header(AVFormatContext *s)
     while ((chapter_pos = avio_tell(pb)) >= 0 && chapter_pos < c->content_end) {
         int chapter_idx = s->nb_chapters;
         uint32_t chapter_size = avio_rb32(pb);
-        if (chapter_size == 0) break;
+        if (chapter_size == 0 || avio_feof(pb))
+            break;
         chapter_pos -= start + CHAPTER_HEADER_SIZE * chapter_idx;
         avio_skip(pb, 4 + chapter_size);
         if (!avpriv_new_chapter(s, chapter_idx, st->time_base,