craigsapp/midifile

Writing past the end of a vector in MidiFile::mergeTracks

beldenfox opened this issue · 1 comments

In the function MidiFile::mergeTracks there are two lines near the bottom that read:

m_events[length] = NULL;
m_events.resize(length-1);

Since length is the number of tracks the first line writes past the end of the m_events vector and corrupts memory. This should be:

m_events[length-1] = NULL;
m_events.resize(length-1);

Thanks! Fixed in commit c036988