When writing invalid MIDI data to a virtual rawmidi port,
snd_rawmidi_virtual_write() would forget to remove that data
from the input buffer before continuing, resulting in an
infinite loop.
size1 = snd_midi_event_encode(virt->midi_event, buffer, size, &virt->out_event);
if (size1 <= 0)
break;
- if (virt->out_event.type == SND_SEQ_EVENT_NONE)
- continue;
size -= size1;
result += size1;
buffer += size1;
+ if (virt->out_event.type == SND_SEQ_EVENT_NONE)
+ continue;
snd_seq_ev_set_subs(&virt->out_event);
snd_seq_ev_set_source(&virt->out_event, virt->port);
snd_seq_ev_set_direct(&virt->out_event);