mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-05-05 06:46:28 -04:00
midifile: reject midi files with invalid values
>64 tracks will overflow the track array and a division of 0 will cause a division by zero later.
This commit is contained in:
parent
c4b198962c
commit
8cf1164eb6
1 changed files with 6 additions and 0 deletions
|
|
@ -182,6 +182,12 @@ static int open_read(struct midi_file *mf, const char *filename, struct midi_fil
|
|||
if ((res = read_mthd(mf)) < 0)
|
||||
goto exit_close;
|
||||
|
||||
if (mf->info.ntracks > SPA_N_ELEMENTS(mf->tracks) ||
|
||||
mf->info.division == 0) {
|
||||
res = -EINVAL;
|
||||
goto exit_close;
|
||||
}
|
||||
|
||||
mf->tempo = DEFAULT_TEMPO;
|
||||
mf->tick = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue