stm32f4xx-hal icon indicating copy to clipboard operation
stm32f4xx-hal copied to clipboard

UnlockedFlash::program can write out of bounds

Open sjorsdewit opened this issue 3 years ago • 0 comments

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?

sjorsdewit avatar Oct 25 '22 11:10 sjorsdewit