size_t is unsigned, so sp_blocking_read() errors are cast to a non-negative value and skip the check on line 111.
This also causes bytes_read to appear to be a very large number (much bigger than serial_read_size) which sends lots of junk to the SLIP call and eventually causes a segfault.
This can be duplicated for test by starting the M8 without an SD card inserted or by unplugging the M8 from USB after it has launched.
Old behavior: Floods of SLIP error 1 messages, then a segfault.
New behavior:
size_t
is unsigned, sosp_blocking_read()
errors are cast to a non-negative value and skip the check on line 111.This also causes
bytes_read
to appear to be a very large number (much bigger thanserial_read_size
) which sends lots of junk to the SLIP call and eventually causes a segfault.This can be duplicated for test by starting the M8 without an SD card inserted or by unplugging the M8 from USB after it has launched. Old behavior: Floods of
SLIP error 1
messages, then a segfault. New behavior:(program terminates)