diff options
author | Damien George <damien@micropython.org> | 2025-02-24 23:14:48 +1100 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2025-02-26 16:11:19 +1100 |
commit | 14ba32bb205fa1f7d6ac456879b08aadb4e1aaf7 (patch) | |
tree | e0993602c59c6b4c20bd81fb4fea5dcc5e64ed78 /tests/float/float_parse.py | |
parent | e3101ce1b3782955ea2d103922f0dc19bc0331f6 (diff) | |
download | micropython-14ba32bb205fa1f7d6ac456879b08aadb4e1aaf7.tar.gz micropython-14ba32bb205fa1f7d6ac456879b08aadb4e1aaf7.zip |
extmod/vfs_rom: Add bounds checking for all filesystem accesses.
Testing with ROMFS shows that it is relatively easy to end up with a
corrupt filesystem on the device -- eg due to the ROMFS deploy process
stopping half way through -- which could lead to hard crashes. Notably,
there can be boot loops trying to mount a corrupt filesystem, crashes when
importing modules like `os` that first scan the filesystem for `os.py`, and
crashing when deploying a new ROMFS in certain cases because the old one is
removed while still mounted.
The main problem is that `mp_decode_uint()` has an loop that keeps going as
long as it reads 0xff byte values, which can happen in the case of erased
and unwritten flash.
This commit adds full bounds checking in the new `mp_decode_uint_checked()`
function, and that makes all ROMFS filesystem accesses robust.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'tests/float/float_parse.py')
0 files changed, 0 insertions, 0 deletions