1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2021-05-04 18:34:44 +02:00
parent 85b883429f
commit b72d657b73

View File

@ -119,6 +119,8 @@ static int tta_read_header(AVFormatContext *s)
for (i = 0; i < c->totalframes; i++) { for (i = 0; i < c->totalframes; i++) {
uint32_t size = avio_rl32(s->pb); uint32_t size = avio_rl32(s->pb);
int r; 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, if ((r = av_add_index_entry(st, framepos, i * (int64_t)c->frame_size, size, 0,
AVINDEX_KEYFRAME)) < 0) AVINDEX_KEYFRAME)) < 0)
return r; return r;