[FFmpeg-cvslog] avformat/tta: Check for EOF in index reading loop

Michael Niedermayer git at videolan.org
Wed Sep 8 22:42:16 EEST 2021


ffmpeg | branch: release/4.4 | Michael Niedermayer <michael at niedermayer.cc> | Tue May  4 18:34:44 2021 +0200| [b354bcf0277277f7de2816e1894c934f5e7f215e] | committer: Michael Niedermayer

avformat/tta: Check for EOF in index reading loop

Fixes: OOM
Fixes: 33585/clusterfuzz-testcase-minimized-ffmpeg_dem_TTA_fuzzer-4564665830080512

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit b72d657b73b2aa4a2a2f72f613199e6080ad48c0)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b354bcf0277277f7de2816e1894c934f5e7f215e
---

 libavformat/tta.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/tta.c b/libavformat/tta.c
index 07faa82eb3..6aa72b5d1d 100644
--- a/libavformat/tta.c
+++ b/libavformat/tta.c
@@ -119,6 +119,8 @@ static int tta_read_header(AVFormatContext *s)
     for (i = 0; i < c->totalframes; i++) {
         uint32_t size = avio_rl32(s->pb);
         int r;
+        if (avio_feof(s->pb))
+            return AVERROR_INVALIDDATA;
         if ((r = av_add_index_entry(st, framepos, i * (int64_t)c->frame_size, size, 0,
                                     AVINDEX_KEYFRAME)) < 0)
             return r;



More information about the ffmpeg-cvslog mailing list