Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Another Windows application hang caused by Arduino code #92

Closed
csatt opened this issue Dec 1, 2019 · 0 comments
Closed

Another Windows application hang caused by Arduino code #92

csatt opened this issue Dec 1, 2019 · 0 comments
Assignees
Labels

Comments

@csatt
Copy link
Owner

csatt commented Dec 1, 2019

Thanks to Pietro Colavito for reporting and helping to debug this.

Unlike Issue #89, this is potentially caused by Arduino sketch versions prior to 1.3.9. It also, however, only affects the Windows application, not the Mac version.

The trigger is the same phenomenon that triggered Issue #89: the Windows application (for a still not understood reason) appends a carriage return character to the end of messages sent via USB to the Arduino. In this case, the message that is affected is:

Config: WRITE_EEPROM 0 123456.7890

This message is sent only when the EEPROM is not valid, which is only the case when a new Arduino is used or if the Calibrate->Invalidate EEPROM menu command is used.

The message is exactly 35 characters long (with the newline), but with the extra carriage return, it is 36. From sketch version 1.3.9 forward, this is detected and the following message is sent back to the host which writes it to the log file:

ERROR: Host message too long: Config: WRITE_EEPROM 0 123456.7890....

The application code that recognizes and handles this error message has not yet been released. The v2.5.1 (or earlier) application continues to wait for the expected response from the Arduino code and the application freezes until the USB cable is unplugged.

Sketch versions before 1.3.9 have no message length checking. Since the "incoming_msg" character array has a length of 35, the 36 character message overflows the buffer by one byte. This memory (stack) corruption can be benign or can cause the sketch to crash. If the sketch crashes, the application hangs until the USB cable is unplugged.

@csatt csatt added the bug label Dec 1, 2019
@csatt csatt self-assigned this Dec 1, 2019
csatt added a commit that referenced this issue Dec 1, 2019
Increased MAX_MSG_LEN from 35 to 40.

Bumped sketch version to 1.3.12
@csatt csatt closed this as completed Dec 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant