aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-12-12 22:19:22 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-03-01 20:19:15 +0100
commitbcc7d14453ea2bafa6569a07002943808f2a396a (patch)
tree016af8a3a51a2e2d76eebc1029451452c8ef04bc /libavformat
parentee50f727158095f77a4fdadd572e3bd59ac101f2 (diff)
downloadffmpeg-bcc7d14453ea2bafa6569a07002943808f2a396a.tar.gz
avformat/aadec: Check for EOF while reading chapters
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>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/aadec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavformat/aadec.c b/libavformat/aadec.c
index 63f8176a57..612e66906d 100644
--- a/libavformat/aadec.c
+++ b/libavformat/aadec.c
@@ -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,