From c956b5e662bb9b3ddc2ed837955c4a17ee1aae82 Mon Sep 17 00:00:00 2001 From: Speykious Date: Wed, 21 Feb 2024 23:19:54 +0100 Subject: [PATCH] Fix segfault for WASM --- src/segfault.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/segfault.rs b/src/segfault.rs index ff1c25c..53660e7 100644 --- a/src/segfault.rs +++ b/src/segfault.rs @@ -10,7 +10,11 @@ pub fn segfault() -> ! { let null = crate::null_mut::(); *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::MAX); + *max = 69; + unreachable!("Sorry, your platform is too strong.") }