midifile: error won invalid track size

When the track data would exceed the file size, return an error.
This commit is contained in:
Wim Taymans 2023-01-05 13:49:52 +01:00
parent 6a516b9505
commit 0ddf80d470

View file

@ -118,6 +118,9 @@ static int read_mtrk(struct midi_file *mf, struct midi_track *track)
track->size = parse_be32(mf->p + 4); track->size = parse_be32(mf->p + 4);
mf->p = track->data + track->size; mf->p = track->data + track->size;
if (mf->p > mf->data + mf->size)
return -EINVAL;
return 0; return 0;
} }