mirror of
https://github.com/micropython/micropython.git
synced 2026-01-04 19:20:22 +01:00
extmod/vfs_reader: Check that open() resulted in a file-like object.
That is, an object whose type defines the protocol slot. Note that due to protocol confusion, a variant of the original crasher that returned e.g., a machine.Pin instance could still lead to a crash (#17852). Fixes issue #17841. Signed-off-by: Jeff Epler <jepler@gmail.com> Signed-off-by: Jeff Epler <jepler@unpythonic.net>
This commit is contained in:
committed by
Damien George
parent
adf6319884
commit
4b013ec3ff
@@ -83,7 +83,7 @@ void mp_reader_new_file(mp_reader_t *reader, qstr filename) {
|
||||
};
|
||||
mp_obj_t file = mp_vfs_open(MP_ARRAY_SIZE(args), &args[0], (mp_map_t *)&mp_const_empty_map);
|
||||
|
||||
const mp_stream_p_t *stream_p = mp_get_stream(file);
|
||||
const mp_stream_p_t *stream_p = mp_get_stream_raise(file, MP_STREAM_OP_READ);
|
||||
int errcode = 0;
|
||||
|
||||
#if MICROPY_VFS_ROM
|
||||
|
||||
Reference in New Issue
Block a user