stm32f4xx-hal
stm32f4xx-hal copied to clipboard
UnlockedFlash::program can write out of bounds
It seems the function UnlockedFlash::program() can write outside the bounds of the flash memory if given an invalid offset:
https://github.com/stm32-rs/stm32f4xx-hal/blob/6d0c29233a4cd1f780b2fef3e47ef091ead6cf4a/src/flash.rs#L239-L241
One way to improve this might be to check offset against self.len() each iteration, or maybe there is a way to pre-compute if the offset + length of the iterator exceeds the flash length?