Skip to content

Commit

Permalink
Merge #580
Browse files Browse the repository at this point in the history
580: Fix UB in destroy_array test r=jeehoonkang a=taiki-e

Reportrd by Miri in #578 ([log](https://github.com/crossbeam-rs/crossbeam/runs/1232029543?check_suite_focus=true))

https://github.com/crossbeam-rs/crossbeam/blob/e08b21cc086fc42af0e9927a68bc3120bee87af5/crossbeam-epoch/src/collector.rs#L378-L388

`ptr` is a pointer to `Vec<i32>`, but deallocated as `Vec<u8>`.

Co-authored-by: Taiki Endo <[email protected]>
  • Loading branch information
bors[bot] and taiki-e authored Oct 9, 2020
2 parents e08b21c + b363b3d commit 5ea6e70
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crossbeam-epoch/src/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ mod tests {
let ptr = v.as_mut_ptr() as usize;
let len = v.len();
guard.defer_unchecked(move || {
drop(Vec::from_raw_parts(ptr as *const u8 as *mut u8, len, len));
drop(Vec::from_raw_parts(ptr as *const i32 as *mut i32, len, len));
DESTROYS.fetch_add(len, Ordering::Relaxed);
});
guard.flush();
Expand Down

0 comments on commit 5ea6e70

Please sign in to comment.