diff mbox series

[FFmpeg-devel,2/3] avformat/tta: Check for EOF in index reading loop

Message ID 20210504210504.13396-2-michael@niedermayer.cc
State Accepted
Commit b72d657b73b2aa4a2a2f72f613199e6080ad48c0
Headers show
Series [FFmpeg-devel,1/3] avutil/tx: avoid negative left shifts | expand

Checks

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

Commit Message

Michael Niedermayer May 4, 2021, 9:05 p.m. UTC
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@niedermayer.cc>
---
 libavformat/tta.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/libavformat/tta.c b/libavformat/tta.c
index 7a95675794..e1f9cf27d8 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;