8283190: Improve MIDI processing
Reviewed-by: prr, rhalade, psadhukhan, mschoene
This commit is contained in:
parent
78c514d085
commit
879ea78037
@ -367,6 +367,11 @@ final class SMFParser {
|
||||
case 0xF7:
|
||||
// sys ex
|
||||
int sysexLength = (int) readVarInt();
|
||||
if (sysexLength < 0 || sysexLength > trackLength - pos) {
|
||||
throw new InvalidMidiDataException("Message length is out of bounds: "
|
||||
+ sysexLength);
|
||||
}
|
||||
|
||||
byte[] sysexData = new byte[sysexLength];
|
||||
read(sysexData);
|
||||
|
||||
@ -379,8 +384,8 @@ final class SMFParser {
|
||||
// meta
|
||||
int metaType = readUnsigned();
|
||||
int metaLength = (int) readVarInt();
|
||||
if (metaLength < 0) {
|
||||
throw new InvalidMidiDataException("length out of bounds: "
|
||||
if (metaLength < 0 || metaLength > trackLength - pos) {
|
||||
throw new InvalidMidiDataException("Message length is out of bounds: "
|
||||
+ metaLength);
|
||||
}
|
||||
final byte[] metaData;
|
||||
|
Loading…
Reference in New Issue
Block a user