Skip to content

Commit

Permalink
Fix integer overflow in filesystem stat implementation. Resolve pycom…
Browse files Browse the repository at this point in the history
…#409. (pycom#129)

Co-authored-by: Andreas Motl <[email protected]>
  • Loading branch information
geza-pycom and amotl authored Jun 10, 2020
1 parent 291d364 commit 9afddc8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions esp32/littlefs/vfs_littlefs.c
Original file line number Diff line number Diff line change
Expand Up @@ -669,9 +669,9 @@ STATIC mp_obj_t littlefs_vfs_stat(mp_obj_t vfs_in, mp_obj_t path_param) {
else {
t->items[6] = mp_obj_new_int_from_uint(0); // st_size
}
t->items[7] = MP_OBJ_NEW_SMALL_INT(seconds); // st_atime
t->items[8] = MP_OBJ_NEW_SMALL_INT(seconds); // st_mtime
t->items[9] = MP_OBJ_NEW_SMALL_INT(seconds); // st_ctime
t->items[7] = mp_obj_new_int_from_uint(seconds); // st_atime
t->items[8] = mp_obj_new_int_from_uint(seconds); // st_mtime
t->items[9] = mp_obj_new_int_from_uint(seconds); // st_ctime

return MP_OBJ_FROM_PTR(t);
}
Expand Down
6 changes: 3 additions & 3 deletions extmod/vfs_fat.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,9 @@ STATIC mp_obj_t fat_vfs_stat(mp_obj_t vfs_in, mp_obj_t path_in) {
t->items[4] = MP_OBJ_NEW_SMALL_INT(0); // st_uid
t->items[5] = MP_OBJ_NEW_SMALL_INT(0); // st_gid
t->items[6] = mp_obj_new_int_from_uint(fno.fsize); // st_size
t->items[7] = MP_OBJ_NEW_SMALL_INT(seconds); // st_atime
t->items[8] = MP_OBJ_NEW_SMALL_INT(seconds); // st_mtime
t->items[9] = MP_OBJ_NEW_SMALL_INT(seconds); // st_ctime
t->items[7] = mp_obj_new_int_from_uint(seconds); // st_atime
t->items[8] = mp_obj_new_int_from_uint(seconds); // st_mtime
t->items[9] = mp_obj_new_int_from_uint(seconds); // st_ctime

return MP_OBJ_FROM_PTR(t);
}
Expand Down

0 comments on commit 9afddc8

Please sign in to comment.