View Single Post
Old 06-13-2021, 09:57 PM   #1
Human being with feelings
lexomir's Avatar
Join Date: Oct 2018
Posts: 36
Default Deadlock after calling MIDI_GetAllEvts (FIXED)

Calling MIDI_GetAllEvts with a buffer size that is too small will corrupt the take, so next time the playhead reaches it the audio engine will deadlock.

Version: 6.29 dev0613a (but probably existed before)

int bufSize = 1024;
std::vector<char> eventbuffer(bufSize);
auto take = ::GetActiveTake(::GetSelectedMediaItem(0, 0));
bool succ = MIDI_GetAllEvts(take,, &bufSize);

I assumed that MIDI_GetAllEvts would return a cropped version of the buffer, and I could grow my vector recursively until I grabbed all the events.

All it takes is one call to MIDI_GetAllEvts with a smaller bufSize to corrupt playback of the take.

Last edited by lexomir; 06-13-2021 at 10:09 PM.
lexomir is offline   Reply With Quote