File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -440,6 +440,7 @@ pub(crate) fn fd_allocate(
440
440
441
441
let current_size = metadata. len ( ) ;
442
442
let wanted_size = offset. checked_add ( len) . ok_or ( host:: __WASI_E2BIG) ?;
443
+ // This check will be unnecessary when rust-lang/rust#63326 is fixed
443
444
if wanted_size > i64:: max_value ( ) as u64 {
444
445
return Err ( host:: __WASI_E2BIG) ;
445
446
}
@@ -779,6 +780,10 @@ pub(crate) fn fd_filestat_set_size(
779
780
. and_then ( |fe| fe. fd_object . descriptor . as_file ( ) ) ?;
780
781
781
782
let st_size = dec_filesize ( st_size) ;
783
+ // This check will be unnecessary when rust-lang/rust#63326 is fixed
784
+ if st_size > i64:: max_value ( ) as u64 {
785
+ return Err ( host:: __WASI_E2BIG) ;
786
+ }
782
787
fd. set_len ( st_size) . map_err ( errno_from_ioerror)
783
788
}
784
789
You can’t perform that action at this time.
0 commit comments