Skip to content

Commit c956b5e

Browse files
committed
Fix segfault for WASM
1 parent fff10a2 commit c956b5e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/segfault.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ pub fn segfault() -> ! {
1010
let null = crate::null_mut::<u8>();
1111
*null = 42;
1212

13-
// WASM. u_u
13+
// If null doesn't work, try max. Surely that'll stop it.
14+
// Confirmed to be effective on WASM.
15+
let max = crate::transmute::<usize, &'static mut u8>(usize::MAX);
16+
*max = 69;
17+
1418
unreachable!("Sorry, your platform is too strong.")
1519
}
1620

0 commit comments

Comments
 (0)