@@ -128,15 +128,18 @@ impl FileDescription for io::Stdin {
128128 _self_ref : & FileDescriptionRef ,
129129 communicate_allowed : bool ,
130130 bytes : & mut [ u8 ] ,
131- _ptr : Pointer ,
132- _dest : & MPlaceTy < ' tcx > ,
133- _ecx : & mut MiriInterpCx < ' tcx > ,
131+ ptr : Pointer ,
132+ dest : & MPlaceTy < ' tcx > ,
133+ ecx : & mut MiriInterpCx < ' tcx > ,
134134 ) -> InterpResult < ' tcx , io:: Result < usize > > {
135135 if !communicate_allowed {
136136 // We want isolation mode to be deterministic, so we have to disallow all reads, even stdin.
137137 helpers:: isolation_abort_error ( "`read` from stdin" ) ?;
138138 }
139- Ok ( Read :: read ( & mut { self } , bytes) )
139+ let result = Ok ( Read :: read ( & mut { self } , bytes) ) ;
140+ ecx. read_byte_helper ( ptr, bytes. to_vec ( ) , result, dest) ?;
141+ // TODO: remove the usize later
142+ Ok ( Ok ( 0 ) )
140143 }
141144
142145 fn is_tty ( & self , communicate_allowed : bool ) -> bool {
@@ -572,19 +575,21 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
572575 // `usize::MAX` because it is bounded by the host's `isize`.
573576
574577 let mut bytes = vec ! [ 0 ; usize :: try_from( count) . unwrap( ) ] ;
575- let result = match offset {
576- None => fd. read ( & fd, communicate, & mut bytes, buf, dest, this) ,
578+ // TODO: fix this later, handle this properly
579+ let _res = match offset {
580+ None => fd. read ( & fd, communicate, & mut bytes, buf, dest, this) ?,
577581 Some ( offset) => {
578582 let Ok ( offset) = u64:: try_from ( offset) else {
579583 let einval = this. eval_libc ( "EINVAL" ) ;
580584 this. set_last_error ( einval) ?;
581585 this. write_scalar ( Scalar :: from_target_isize ( -1 , this) , dest) ?;
582586 return Ok ( ( ) ) ;
583587 } ;
584- fd. pread ( communicate, & mut bytes, offset, this)
588+ let result = fd. pread ( communicate, & mut bytes, offset, this) ;
589+ self . read_byte_helper ( buf, bytes, result, dest) ?;
590+ return Ok ( ( ) ) ;
585591 }
586592 } ;
587- self . read_byte_helper ( buf, bytes, result, dest) ?;
588593 Ok ( ( ) )
589594 }
590595
0 commit comments