diff --git a/libavformat/mov.c b/libavformat/mov.c index 405476fd71..b97aa001a3 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -5394,6 +5394,13 @@ static int read_tfra(MOVContext *mov, AVIOContext *f) } for (i = 0; i < index->item_count; i++) { int64_t time, offset; + + if (avio_feof(f)) { + index->item_count = 0; + av_freep(&index->items); + return AVERROR_INVALIDDATA; + } + if (version == 1) { time = avio_rb64(f); offset = avio_rb64(f);