Skip to content

Commit

Permalink
Fix segfault for WASM
Browse files Browse the repository at this point in the history
  • Loading branch information
Speykious committed Feb 21, 2024
1 parent fff10a2 commit c956b5e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/segfault.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ pub fn segfault() -> ! {
let null = crate::null_mut::<u8>();
*null = 42;

// WASM. u_u
// If null doesn't work, try max. Surely that'll stop it.
// Confirmed to be effective on WASM.
let max = crate::transmute::<usize, &'static mut u8>(usize::MAX);
*max = 69;

unreachable!("Sorry, your platform is too strong.")
}

Expand Down

0 comments on commit c956b5e

Please sign in to comment.