File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -653,19 +653,14 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
653653 dest : & MPlaceTy < ' tcx > ,
654654 ) -> InterpResult < ' tcx > {
655655 let this = self . eval_context_mut ( ) ;
656- // `File::read` never returns a value larger than `count`, so this cannot fail.
657- match result. map ( |c| i64:: try_from ( c) . unwrap ( ) ) {
658- // try to pass this the write_ptr inside write
659- // Pass the pointer inside the write function.
656+ match result {
660657 Ok ( read_bytes) => {
661658 // If reading to `bytes` did not fail, we write those bytes to the buffer.
662659 // Crucially, if fewer than `bytes.len()` bytes were read, only write
663660 // that much into the output buffer!
664- this. write_bytes_ptr (
665- buf,
666- bytes[ ..usize:: try_from ( read_bytes) . unwrap ( ) ] . iter ( ) . copied ( ) ,
667- ) ?;
668- this. write_int ( read_bytes, dest) ?;
661+ this. write_bytes_ptr ( buf, bytes[ ..read_bytes] . iter ( ) . copied ( ) ) ?;
662+ // The actual read size is always lesser than `count` so this cannot fail.
663+ this. write_int ( u64:: try_from ( read_bytes) . unwrap ( ) , dest) ?;
669664 return Ok ( ( ) ) ;
670665 }
671666 Err ( e) => {
You can’t perform that action at this time.
0 commit comments