summaryrefslogtreecommitdiff
path: root/libs/ardour/midi_buffer.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-12-21 18:10:58 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-12-21 18:10:58 +0000
commit302ac289ba7ae1cda87ce0ee5fe7a7c345dde9c9 (patch)
tree2fb000218136b2067e44dc13467e3e2e1e30d10b /libs/ardour/midi_buffer.cc
parent8d05ed8e8a487e98ed182ae5b6c98e2160250bf8 (diff)
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
Diffstat (limited to 'libs/ardour/midi_buffer.cc')
-rw-r--r--libs/ardour/midi_buffer.cc10
1 files changed, 10 insertions, 0 deletions
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.