static MOVFragmentStreamInfo * get_current_frag_stream_info(
MOVFragmentIndex *frag_index)
{
- MOVFragmentIndexItem * item = &frag_index->item[frag_index->current];
+ MOVFragmentIndexItem *item;
+ if (frag_index->current < 0 ||
+ frag_index->current >= frag_index->nb_items)
+ return NULL;
+
+ item = &frag_index->item[frag_index->current];
if (item->current >= 0 && item->current < item->nb_stream_info)
return &item->stream_info[item->current];
avio_rb24(pb); /* flags */
entries = avio_rb32(pb);
+ if ((uint64_t)entries * 12 + 4 > atom.size)
+ return AVERROR_INVALIDDATA;
av_log(c->fc, AV_LOG_TRACE, "track[%u].stsc.entries = %u\n", c->fc->nb_streams - 1, entries);
// Free the old index and the old CTTS structures
av_free(e_old);
av_free(ctts_data_old);
+ av_freep(&frame_duration_buffer);
// Null terminate the index ranges array
current_index_range++;