<Sound Dev> [13] Review Request: 8221445 FastSysexMessage constructor crashes MIDI receiption thread

Ralf Suckow ralf.suckow at ableton.com
Mon Apr 8 09:10:25 UTC 2019


Looks good to me.

Yours,
Ralf

PS. Interesting to know the actual root cause.

Am 05.04.2019 um 08:22 schrieb Sergey Bylokhov:
> Hello, Audio Guru.
>
> Please review the fix for jdk13.
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8221445
> Fix: http://cr.openjdk.java.net/~serb/8221445/webrev.00
>
> We can get unexpected ArrayIndexOutOfBoundsException, when we create the 
> FastSysexMessage in this place:
> http://hg.openjdk.java.net/jdk/jdk/file/532e88de77eb/src/java.desktop/share/classes/com/sun/media/sound/AbstractMidiDevice.java#l684 
>
>
> Th root cause of the failure is the empty "data", which is incorrect sysex message. 
> According to the specification in this case the InvalidMidiDataException should be 
> thrown. And the code above which creates the FastSysexMessage is ready for this exception:
>
>   } catch (InvalidMidiDataException e) {
>     // this happens when invalid data comes over the wire. Ignore it.
>     return;
>   }
>
> Wrong exception is occurred, because in the FastSysexMessage we do not throw any 
> exceptions, but instead we call super.setMessage() for the broken data with assumption 
> that the parent class will throw correct exception. But unfortunately the parent 
> class(unlike FastSysexMessage) does not have the check for the empty array.
>
> PS: It is also interesting the in some cases we throw IndexOutOfBoundsException which is 
> not specified in the javadoc, I'll update the spec later.
>



More information about the sound-dev mailing list