mirror of
https://github.com/micropython/micropython.git
synced 2025-12-16 09:50:15 +01:00
extmod/vfs_blockdev: Check return type is an integer.
This catches cases where the return type is not a small int, eg it could be a string, or even a big integer. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -69,7 +69,7 @@ static int mp_vfs_blockdev_call_rw(mp_obj_t *args, size_t block_num, size_t bloc
|
||||
// and negative integer on errors. Check for positive integer
|
||||
// results as some callers (i.e. littlefs) will produce corrupt
|
||||
// results from these.
|
||||
int i = MP_OBJ_SMALL_INT_VALUE(ret);
|
||||
int i = mp_obj_get_int(ret);
|
||||
return i > 0 ? (-MP_EINVAL) : i;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user