Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect load corrupt midi file #71

Open
ghost opened this issue May 10, 2022 · 1 comment
Open

Detect load corrupt midi file #71

ghost opened this issue May 10, 2022 · 1 comment

Comments

@ghost
Copy link

ghost commented May 10, 2022

https://github.com/linthesia/linthesia/blob/main/src/libmidi/MidiTrack.cpp on line 40 it should be

if (header != MidiTrackHeader)
    throw MidiError(MidiError_BadTrackHeaderType)

Otherwise, the exception will not be caught in:

try {
     midi = new Midi(Midi::ReadFromFile(file_opt));
 }catch (const MidiError &e) {...}

Test file: https://github.com/jazz-soft/test-midi-files/blob/main/midi/test-non-midi-track.mid

@albfan
Copy link
Contributor

albfan commented May 11, 2022

Please, turn into a PR so you can be properly credited.

@albfan albfan changed the title An exception is thrown without the MidiError constructor Detect load corrupt midi file May 12, 2022
@linthesia linthesia deleted a comment May 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant