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

Fixed an invalid memory read when handling MIDI reset messages

This commit is contained in:
Tom Poole 2018-09-10 12:02:16 +01:00
parent 93ea3d922f
commit e1e3b42b4f
3 changed files with 32 additions and 18 deletions

View file

@ -224,9 +224,16 @@ MidiMessage::MidiMessage (const void* srcData, int sz, int& numBytesUsed, const
}
else if (byte == 0xff)
{
int n;
const int bytesLeft = readVariableLengthVal (src + 1, n);
size = jmin (sz + 1, n + 2 + bytesLeft);
if (sz == 1)
{
size = 1;
}
else
{
int n;
const int bytesLeft = readVariableLengthVal (src + 1, n);
size = jmin (sz + 1, n + 2 + bytesLeft);
}
auto dest = allocateSpace (size);
*dest = (uint8) byte;