mirror of
https://github.com/hathach/tinyusb.git
synced 2025-10-29 19:49:07 +00:00
fix #3239: discard poorly formed packets
This commit is contained in:
parent
8304587d77
commit
0263cfc01a
@ -575,6 +575,11 @@ uint32_t tuh_midi_stream_read(uint8_t idx, uint8_t *p_cable_num, uint8_t *p_buff
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// bad packet discard
|
||||
nread = tu_edpt_stream_read(p_midi->daddr, &p_midi->ep_stream.rx, p_midi->stream_read.buffer, 4);
|
||||
continue;
|
||||
}
|
||||
} else if (status < MIDI_STATUS_SYSEX_START) {
|
||||
// then it is a channel message either three bytes or two
|
||||
uint8_t fake_cin = (status & 0xf0) >> 4;
|
||||
@ -617,6 +622,11 @@ uint32_t tuh_midi_stream_read(uint8_t idx, uint8_t *p_cable_num, uint8_t *p_buff
|
||||
bytes_to_add_to_stream = 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// bad packet discard
|
||||
nread = tu_edpt_stream_read(p_midi->daddr, &p_midi->ep_stream.rx, p_midi->stream_read.buffer, 4);
|
||||
continue;
|
||||
}
|
||||
|
||||
for (uint8_t i = 1; i <= bytes_to_add_to_stream; i++) {
|
||||
*p_buffer++ = p_midi->stream_read.buffer[i];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user