mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[python] Prevent waiting for 2^32 ms if user entered a negative delay
This is due to a missing check in the interruptible sleep function which was not checking if the delay was negative, then was passed to the Ion::Timing::usleep function, who only takes signed values
This commit is contained in:
@@ -33,6 +33,11 @@ void micropython_port_vm_hook_refresh_print() {
|
||||
}
|
||||
|
||||
bool micropython_port_interruptible_msleep(int32_t delay) {
|
||||
// Check if the user entered a bad delay (negative)
|
||||
if (delay < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
assert(delay >= 0);
|
||||
/* We don't use millis because the systick drifts when changing the HCLK
|
||||
* frequency. */
|
||||
|
||||
Reference in New Issue
Block a user