-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
Description
Description
In the STM platform serial_device.c driver (I think all series of STM targets are the same in this issue), handler serial_irq_handler_asynch
, the local variable i
is defined as uint8_t
. When the size of the rx_buff passed in to the original call to read
is larger than 256 bytes, the following piece of code would loop forever due to overflowing of i
.
if (obj_s->events & SERIAL_EVENT_RX_CHARACTER_MATCH) {
if (buf != NULL) {
for (i = 0; i < obj->rx_buff.pos; i++) { // <---------------- PROBLEM
if (buf[i] == obj->char_match) {
obj->rx_buff.pos = i;
return_event |= (SERIAL_EVENT_RX_CHARACTER_MATCH & obj_s->events);
serial_rx_abort_asynch(obj);
break;
}
}
}
}
Result is hanging up of the MCU since this is in an IRQ. This is tested on NUCLEO_L476RG board.
Issue request type
[ ] Question
[ ] Enhancement
[X] Bug