Skip to content

Commit f918de8

Browse files
committed
make sure we read all arguments before returning early
1 parent 8ae118d commit f918de8

File tree

1 file changed

+5
-3
lines changed
  • src/tools/miri/src/shims/unix/linux

1 file changed

+5
-3
lines changed

src/tools/miri/src/shims/unix/linux/epoll.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,10 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
402402
let this = self.eval_context_mut();
403403

404404
let epfd = this.read_scalar(epfd)?.to_i32()?;
405+
let events = this.read_immediate(events_op)?;
405406
let maxevents = this.read_scalar(maxevents)?.to_i32()?;
406407
let timeout = this.read_scalar(timeout)?.to_i32()?;
408+
407409
if epfd <= 0 || maxevents <= 0 {
408410
let einval = this.eval_libc("EINVAL");
409411
this.set_last_error(einval)?;
@@ -412,8 +414,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
412414

413415
// This needs to come after the maxevents value check, or else maxevents.try_into().unwrap()
414416
// will fail.
415-
let event = this.deref_pointer_as(
416-
events_op,
417+
let events = this.deref_pointer_as(
418+
&events,
417419
this.libc_array_ty_layout("epoll_event", maxevents.try_into().unwrap()),
418420
)?;
419421

@@ -432,7 +434,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
432434
let ready_list = epoll_file_description.get_ready_list();
433435
let mut ready_list = ready_list.borrow_mut();
434436
let mut num_of_events: i32 = 0;
435-
let mut array_iter = this.project_array_fields(&event)?;
437+
let mut array_iter = this.project_array_fields(&events)?;
436438

437439
while let Some((epoll_key, epoll_return)) = ready_list.pop_first() {
438440
// If the file description is fully close, the entry for corresponding FdID in the

0 commit comments

Comments
 (0)