alidate the operand passed to is_val_statically_known

This commit is contained in:
Ralf Jung 2024-01-26 07:56:36 +01:00
parent b8246e3847
commit 2318b0825c

View File

@ -148,7 +148,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
// ```
// Would not be considered UB, or the other way around (`is_val_statically_known(0)`).
"is_val_statically_known" => {
let [_] = check_arg_count(args)?;
let [arg] = check_arg_count(args)?;
this.validate_operand(arg)?;
let branch: bool = this.machine.rng.get_mut().gen();
this.write_scalar(Scalar::from_bool(branch), dest)?;
}