View Single Post
Old 06-13-2021, 09:57 PM   #1
lexomir
Human being with feelings
 
lexomir's Avatar
 
Join Date: Oct 2018
Posts: 25
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)


Code:
Code:
int bufSize = 1024;
std::vector<char> eventbuffer(bufSize);
auto take = ::GetActiveTake(::GetSelectedMediaItem(0, 0));
bool succ = MIDI_GetAllEvts(take, eventbuffer.data(), &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