diff --git a/base/src/sys/windows/sched.rs b/base/src/sys/windows/sched.rs index b96c954c03..26a9bc96c4 100644 --- a/base/src/sys/windows/sched.rs +++ b/base/src/sys/windows/sched.rs @@ -28,6 +28,9 @@ use super::Result; pub fn set_cpu_affinity>(cpus: I) -> Result { let mut affinity_mask: usize = 0; for cpu in cpus { + if cpu >= 64 { + return Err(Error::new(EINVAL)); + } affinity_mask |= 1 << cpu; } set_cpu_affinity_mask(affinity_mask)