From 302ac289ba7ae1cda87ce0ee5fe7a7c345dde9c9 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 21 Dec 2011 18:10:58 +0000 Subject: likely fix for crash in MidiBuffer::merge_in_place() due to unwarranted assumption in the code git-svn-id: svn://localhost/ardour2/branches/3.0@11051 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/midi_buffer.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'libs/ardour/midi_buffer.cc') diff --git a/libs/ardour/midi_buffer.cc b/libs/ardour/midi_buffer.cc index 6e07a1bedd..dee4885505 100644 --- a/libs/ardour/midi_buffer.cc +++ b/libs/ardour/midi_buffer.cc @@ -506,6 +506,16 @@ MidiBuffer::merge_in_place(const MidiBuffer &other) } else if (them != other.end()) { + if ((*us).time() < ((*them).time())) { + + /* just append the rest of other */ + + memcpy (_data + us.offset, other._data + them.offset, other._size - them.offset); + _size += other._size - them.offset; + assert(_size <= _capacity); + break; + } + /* to get here implies that we've encountered two * messages with the same timestamp. we must order * them correctly. -- cgit v1.2.3