Skip to content

Commit 6c2fc6d

Browse files
authored
Merge pull request #589 from RalfJung/check-bounds
use memory::check_bounds_ptr for offset check
2 parents d0f57c7 + f2e14d9 commit 6c2fc6d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Diff for: src/operator.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,9 @@ impl<'a, 'mir, 'tcx> EvalContextExt<'tcx> for super::MiriEvalContext<'a, 'mir, '
303303
if let Scalar::Ptr(ptr) = ptr {
304304
// Both old and new pointer must be in-bounds of a *live* allocation.
305305
// (Of the same allocation, but that part is trivial with our representation.)
306-
let alloc = self.memory().get(ptr.alloc_id)?;
307-
alloc.check_bounds_ptr(ptr)?;
306+
self.memory().check_bounds_ptr(ptr, InboundsCheck::Live)?;
308307
let ptr = ptr.signed_offset(offset, self)?;
309-
alloc.check_bounds_ptr(ptr)?;
308+
self.memory().check_bounds_ptr(ptr, InboundsCheck::Live)?;
310309
Ok(Scalar::Ptr(ptr))
311310
} else {
312311
// An integer pointer. They can only be offset by 0, and we pretend there

0 commit comments

Comments
 (0)