8273290: Enhance sound handling

Reviewed-by: bae
This commit is contained in:
Aleksei Voitylov 2021-11-26 15:09:00 +03:00
parent ebeadc89d3
commit d91d3e7350
2 changed files with 8 additions and 0 deletions

View File

@ -386,6 +386,10 @@ final class SMFParser {
// meta
int metaType = readUnsigned();
int metaLength = (int) readVarInt();
if (metaLength < 0) {
throw new InvalidMidiDataException("length out of bounds: "
+ metaLength);
}
byte[] metaData = new byte[metaLength];
read(metaData);

View File

@ -89,6 +89,10 @@ public final class WaveFloatFileReader extends AudioFileReader {
samplerate = chunk.readUnsignedInt();
/* framerate = */chunk.readUnsignedInt();
framesize = chunk.readUnsignedShort();
if (framesize == 0) {
throw new UnsupportedAudioFileException(
"Can not process audio format with 0 frame size");
}
bits = chunk.readUnsignedShort();
}
if (chunk.getFormat().equals("data")) {