aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-11-18 00:58:37 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-10-09 22:02:19 +0200
commitb25aae7253cea8ce25f73e37a765a3a74c9a3dd7 (patch)
treed89c1c3101348203be253d55187bdc4d7ad4a4b3
parent631e300654528fad433931d4ed9d9ac0be741687 (diff)
downloadffmpeg-b25aae7253cea8ce25f73e37a765a3a74c9a3dd7.tar.gz
avformat/cafdec: Check for EOF in index read loop
Fixes: OOM Fixes: 27398/clusterfuzz-testcase-minimized-ffmpeg_dem_CAF_fuzzer-541296033975500 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit eb46939e3ab3e0e4df69486b1a037bffc50493bd) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/cafdec.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c
index 0aaad3b83d..8c31ded164 100644
--- a/libavformat/cafdec.c
+++ b/libavformat/cafdec.c
@@ -199,6 +199,8 @@ static int read_pakt_chunk(AVFormatContext *s, int64_t size)
st->duration = 0;
for (i = 0; i < num_packets; i++) {
+ if (avio_feof(pb))
+ return AVERROR_INVALIDDATA;
av_add_index_entry(s->streams[0], pos, st->duration, 0, 0, AVINDEX_KEYFRAME);
pos += caf->bytes_per_packet ? caf->bytes_per_packet : ff_mp4_read_descr_len(pb);
st->duration += caf->frames_per_packet ? caf->frames_per_packet : ff_mp4_read_descr_len(pb);