This commit is contained in:
The Miri Cronjob Bot 2024-08-02 05:05:50 +00:00
parent 85ed3fe55d
commit fc260e163a
2 changed files with 6 additions and 3 deletions

View File

@ -673,7 +673,8 @@ trait EvalContextPrivExt<'tcx, 'ecx>: crate::MiriInterpCxExt<'tcx> {
// attempt to use it for a non-zero-sized access.
// Dangling slices are a common case here; it's valid to get their length but with raw
// pointer tagging for example all calls to get_unchecked on them are invalid.
if let Ok((alloc_id, base_offset, orig_tag)) = this.ptr_try_get_alloc_id(place.ptr(), 0) {
if let Ok((alloc_id, base_offset, orig_tag)) = this.ptr_try_get_alloc_id(place.ptr(), 0)
{
log_creation(this, Some((alloc_id, base_offset, orig_tag)))?;
// Still give it the new provenance, it got retagged after all.
return Ok(Some(Provenance::Concrete { alloc_id, tag: new_tag }));

View File

@ -81,8 +81,10 @@ impl<'tcx> UnixEnvVars<'tcx> {
return Ok(None);
};
// The offset is used to strip the "{name}=" part of the string.
let var_ptr = var_ptr
.wrapping_offset(Size::from_bytes(u64::try_from(name.len()).unwrap().strict_add(1)), ecx);
let var_ptr = var_ptr.wrapping_offset(
Size::from_bytes(u64::try_from(name.len()).unwrap().strict_add(1)),
ecx,
);
Ok(Some(var_ptr))
}