diff options
Diffstat (limited to 'libs/ardour/midi_buffer.cc')
-rw-r--r-- | libs/ardour/midi_buffer.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libs/ardour/midi_buffer.cc b/libs/ardour/midi_buffer.cc index b0e46f8ad1..8a7d67e2e6 100644 --- a/libs/ardour/midi_buffer.cc +++ b/libs/ardour/midi_buffer.cc @@ -135,8 +135,12 @@ MidiBuffer::push_back(const Evoral::MIDIEvent<TimeType>& ev) << " stamp size: " << stamp_size << " \n";*/ if (_size + stamp_size + ev.size() >= _capacity) { - cerr << "MidiBuffer::push_back failed (buffer is full)" - << endl; + cerr << "MidiBuffer::push_back failed (buffer is full)" << endl; + return false; + } + + if (!Evoral::midi_event_is_valid(ev.buffer(), ev.size())) { + cerr << "WARNING: MidiBuffer ignoring illegal MIDI event" << endl; return false; } @@ -166,6 +170,11 @@ MidiBuffer::push_back(const jack_midi_event_t& ev) cerr << "MidiBuffer::push_back failed (buffer is full)" << endl; return false; } + + if (!Evoral::midi_event_is_valid(ev.buffer, ev.size)) { + cerr << "WARNING: MidiBuffer ignoring illegal MIDI event" << endl; + return false; + } uint8_t* const write_loc = _data + _size; *((TimeType*)write_loc) = ev.time; |