Browse Source

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

tags/2021-05-28
jules 9 years ago
parent
commit
1a5f71b74d
1 changed files with 10 additions and 3 deletions
  1. +10
    -3
      modules/juce_audio_devices/native/juce_MidiDataConcatenator.h

+ 10
- 3
modules/juce_audio_devices/native/juce_MidiDataConcatenator.h View File

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


Loading…
Cancel
Save