avformat/mxfdec: check index entry array size

Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
Marton Balint 2022-12-28 02:36:57 +01:00
parent 757218564d
commit 6aff3c5e43
1 changed files with 5 additions and 1 deletions

View File

@ -1198,11 +1198,15 @@ static int mxf_read_essence_container_data(void *arg, AVIOContext *pb, int tag,
static int mxf_read_index_entry_array(AVIOContext *pb, MXFIndexTableSegment *segment) static int mxf_read_index_entry_array(AVIOContext *pb, MXFIndexTableSegment *segment)
{ {
int i, length; int i, length;
uint32_t nb_index_entries;
if (segment->temporal_offset_entries) if (segment->temporal_offset_entries)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
segment->nb_index_entries = avio_rb32(pb); nb_index_entries = avio_rb32(pb);
if (nb_index_entries > INT_MAX)
return AVERROR_INVALIDDATA;
segment->nb_index_entries = nb_index_entries;
length = avio_rb32(pb); length = avio_rb32(pb);
if(segment->nb_index_entries && length < 11) if(segment->nb_index_entries && length < 11)