Skip to content

Commit 3f323a6

Browse files
committed
abort instead of ub for invalid handle in closehandle
1 parent b3bcc4b commit 3f323a6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/shims/windows/handle.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,10 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
144144

145145
match Handle::from_scalar(this.read_scalar(handle_op)?.check_init()?, this)? {
146146
Some(Handle::Thread(thread)) => this.detach_thread(thread)?,
147-
_ => throw_ub_format!("invalid handle"),
147+
_ =>
148+
throw_machine_stop!(TerminationInfo::Abort(
149+
"invalid handle passed to `CloseHandle`".into()
150+
)),
148151
};
149152

150153
Ok(())

0 commit comments

Comments
 (0)