commit
ded5a52639
@ -1 +1 @@
|
||||
2d2be570970d784db5539a1d309cd22b85be910a
|
||||
21ed50522ddb998f5367229984a4510af578899f
|
||||
|
@ -219,7 +219,7 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
|
||||
fn assert_panic(
|
||||
ecx: &mut InterpCx<'mir, 'tcx, Self>,
|
||||
span: Span,
|
||||
msg: &AssertMessage<'tcx>,
|
||||
msg: &mir::AssertMessage<'tcx>,
|
||||
unwind: Option<mir::BasicBlock>,
|
||||
) -> InterpResult<'tcx> {
|
||||
ecx.assert_panic(span, msg, unwind)
|
||||
|
@ -105,7 +105,7 @@ impl<'mir, 'tcx> EvalContextExt<'tcx> for super::MiriEvalContext<'mir, 'tcx> {
|
||||
let pointee_size = i64::try_from(self.layout_of(pointee_ty)?.size.bytes()).unwrap();
|
||||
let offset = offset
|
||||
.checked_mul(pointee_size)
|
||||
.ok_or_else(|| err_panic!(Overflow(mir::BinOp::Mul)))?;
|
||||
.ok_or_else(|| err_ub_format!("overflow during offset comutation for inbounds pointer arithmetic"))?;
|
||||
// We do this first, to rule out overflows.
|
||||
let offset_ptr = ptr.ptr_signed_offset(offset, self)?;
|
||||
// What we need to check is that starting at `min(ptr, offset_ptr)`,
|
||||
|
@ -177,7 +177,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
|
||||
let items = this.read_scalar(args[0])?.to_machine_usize(this)?;
|
||||
let len = this.read_scalar(args[1])?.to_machine_usize(this)?;
|
||||
let size =
|
||||
items.checked_mul(len).ok_or_else(|| err_panic!(Overflow(mir::BinOp::Mul)))?;
|
||||
items.checked_mul(len).ok_or_else(|| err_ub_format!("overflow during calloc size computation"))?;
|
||||
let res = this.malloc(size, /*zero_init:*/ true, MiriMemoryKind::C);
|
||||
this.write_scalar(res, dest)?;
|
||||
}
|
||||
|
@ -153,10 +153,10 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
|
||||
fn assert_panic(
|
||||
&mut self,
|
||||
span: Span,
|
||||
msg: &AssertMessage<'tcx>,
|
||||
msg: &mir::AssertMessage<'tcx>,
|
||||
unwind: Option<mir::BasicBlock>,
|
||||
) -> InterpResult<'tcx> {
|
||||
use rustc::mir::interpret::PanicInfo::*;
|
||||
use rustc::mir::AssertKind::*;
|
||||
let this = self.eval_context_mut();
|
||||
|
||||
match msg {
|
||||
|
Loading…
x
Reference in New Issue
Block a user