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

Philip Race philip.race at oracle.com
Sun Apr 7 23:07:56 UTC 2019


+1

-phil

On 4/4/19, 11:22 PM, Sergey Bylokhov wrote:
> 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