Skip to content

Commit 37c744d

Browse files
committed
Address review comments
1 parent aed1e7a commit 37c744d

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/shims/foreign_items.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,16 +272,13 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
272272
)?;
273273
}
274274
"__rust_realloc" => {
275-
let ptr = match this.read_scalar(args[0])?.not_undef()? {
276-
Scalar::Ptr(p) => p,
277-
Scalar::Raw { .. } => throw_ub_format!("cannot reallocate integer addresses"),
278-
};
279275
let old_size = this.read_scalar(args[1])?.to_machine_usize(this)?;
280276
let align = this.read_scalar(args[2])?.to_machine_usize(this)?;
281277
let new_size = this.read_scalar(args[3])?.to_machine_usize(this)?;
282278
if old_size == 0 || new_size == 0 {
283279
throw_unsup!(HeapAllocZeroBytes);
284280
}
281+
let ptr = this.force_ptr(this.read_scalar(args[0])?)?;
285282
if !align.is_power_of_two() {
286283
throw_unsup!(HeapAllocNonPowerOfTwoAlignment(align));
287284
}

0 commit comments

Comments
 (0)