microsoft / MIDI

Windows MIDI Services
MIT License
289 stars 23 forks source link

[BUG] MidiSrv gets stuck by sending MT3. #300

Closed m-komo closed 14 hours ago

m-komo commented 4 months ago

Describe the bug If I send a zero length System Exclusive message (F0 F7) in MT3 format, MIDI Service gets stuck. If this happens, MidiSrv cannot be stopped and restarting OS is required.

This issue only occurs if I send a message to the USB MIDI 1.0 device running with the USB MIDI 2.0 driver (USBMidi2.sys). If I send a same message to the USB MIDI 1.0 device running with the USB MIDI 1.0 driver (USBAUDIO.sys) or the USB MIDI 2.0 device running with the USB MIDI 2.0 driver (USBMidi2.sys), this issue never happens.

To Reproduce

  1. Set the Roland UM-ONE mk2 to class-compliant mode and attach it to the UM-ONE to PC.
  2. Assign the USB MIDI 2.0 driver (USBMidi2.sys) to the attached UM-ONE.
  3. Open midi.exe in two windows.
  4. From one, monitor UM-ONE.
  5. From the other, run following command: 'midi endpoint send-message 0x30000000 0x00000000'
  6. On the monitor window, press escape to stop monitoring. Monitoring cannot be terminated. And finally, it is necessary to restart OS to recover.

Expected behavior The message '0x30000000 0x00000000' is looped back and MIDI Service and midi console continue to work.

Installer Name or Version Windows.MIDI.Services.Developer.Preview.5.x64.1.0.24066.2126.exe

Desktop (please complete the following information):

Device information, if this is with an external MIDI device:

Application Information midi.exe console app.

Psychlist1972 commented 4 months ago

This is a tough one Michael, as it's garbage data. MIDI Services passes it along because it fits the UMP message type and size, and we don't validate beyond that.

If translation to valid byte stream message fails, I would just abort translating that UMP and discard it.

Psychlist1972 commented 4 months ago

@AmeNote-Michael I suppose you could just convert this case to empty sysex F0/F7 with no data in between. That would presumably be better than just dropping the message.

AmeNote-Michael commented 2 months ago

@Psychlist1972 this will be resolved with new SYSEX handling in driver using AM Lib.

AmeNote-Michael commented 2 months ago

Next attestation signed driver.

AmeNote-Michael commented 3 weeks ago

The driver did not previous handle empty SYSEX message. Driver now handles empty SYSEX message F0 F7 in both directions: UMP <-> USB MIDI 1.0. and this is resolved in upcoming pull request.

sat-okada commented 1 day ago

I have confirmed that this issue is resolved with the latest version of the driver (23.1.50.504) and dp6.

m-komo commented 14 hours ago

I have confirmed that the issue has been solved.