1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Added some logic to MidiDataConcatenator that avoids asserting on invalid input data

This commit is contained in:
jules 2016-06-07 16:54:18 +01:00
parent ec40f0940c
commit 1a5f71b74d

View file

@ -71,8 +71,7 @@ public:
// the normal message, handle it now..
if (*d >= 0xf8 && *d <= 0xfe)
{
const MidiMessage m (*d++, time);
callback.handleIncomingMidiMessage (input, m);
callback.handleIncomingMidiMessage (input, MidiMessage (*d++, time));
--numBytes;
}
else
@ -83,7 +82,15 @@ public:
data[len++] = *d++;
--numBytes;
if (len >= MidiMessage::getMessageLengthFromFirstByte (data[0]))
const uint8 firstByte = data[0];
if (firstByte < 0x80 || firstByte == 0xf7)
{
len = 0;
break; // ignore this malformed MIDI message..
}
if (len >= MidiMessage::getMessageLengthFromFirstByte (firstByte))
break;
}
}