@@ -128,15 +128,18 @@ impl FileDescription for io::Stdin {
128
128
_self_ref : & FileDescriptionRef ,
129
129
communicate_allowed : bool ,
130
130
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 > ,
134
134
) -> InterpResult < ' tcx , io:: Result < usize > > {
135
135
if !communicate_allowed {
136
136
// We want isolation mode to be deterministic, so we have to disallow all reads, even stdin.
137
137
helpers:: isolation_abort_error ( "`read` from stdin" ) ?;
138
138
}
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 ) )
140
143
}
141
144
142
145
fn is_tty ( & self , communicate_allowed : bool ) -> bool {
@@ -572,19 +575,21 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
572
575
// `usize::MAX` because it is bounded by the host's `isize`.
573
576
574
577
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) ?,
577
581
Some ( offset) => {
578
582
let Ok ( offset) = u64:: try_from ( offset) else {
579
583
let einval = this. eval_libc ( "EINVAL" ) ;
580
584
this. set_last_error ( einval) ?;
581
585
this. write_scalar ( Scalar :: from_target_isize ( -1 , this) , dest) ?;
582
586
return Ok ( ( ) ) ;
583
587
} ;
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 ( ( ) ) ;
585
591
}
586
592
} ;
587
- self . read_byte_helper ( buf, bytes, result, dest) ?;
588
593
Ok ( ( ) )
589
594
}
590
595
0 commit comments