VRCPortMidi.cs, part of the VRChat SDK, has no bounds check for input data. This leads to log spam and data loss with MIDI-intensive inputs in both editor and client.
Error in editor:
IndexOutOfRangeException: Index was outside the bounds of the array.
VRC.SDKBase.Midi.VRCPortMidiInput.Update () (at ./Packages/com.vrchat.worlds/Runtime/VRCSDK/SDK3/Midi/VRCPortMidi.cs:71)
VRC.SDK3.Midi.VRCMidiHandler.Update () (at <947e39e17d4040a8ae3f6b8caf682c06>:0)
Error in client log:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at ÏÎÌÌÏÏÎÌÌÎÌÏÌÌÎÍÍÌÌÍÌÏÎ.Update () [0x00000] in <00000000000000000000000000000000>:0
at VRC.SDK3.Midi.VRCMidiHandler.Update () [0x00000] in <00000000000000000000000000000000>:0
2025.07.26 19:09:01 Error - Index was outside the bounds of the array.
The error occurs on VRCPortMidi.cs Line 71:
ConvertAndSend(_data[i], _data[i + 1], _data[i + 2]);
Proposed fix: Add a bounds check before entering the loop on line 69, such as:
count = count > _data.Length - 8 ? _data.Length - 8 : count;