Created
August 11, 2024 18:54
-
-
Save No-Eul/c094aef9dbdc48c80567562bad1b6cfb to your computer and use it in GitHub Desktop.
JVMCrasher
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sun.misc.Unsafe; | |
import java.lang.invoke.MethodHandles; | |
public class Main { | |
public static void main(String[] args) throws Throwable { | |
Unsafe unsafe = (Unsafe) MethodHandles.privateLookupIn(Unsafe.class, MethodHandles.lookup()) | |
.findStaticGetter(Unsafe.class, "theUnsafe", Unsafe.class) | |
.invoke(); | |
unsafe.setMemory(0L, 1L, (byte) 0); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Jshell snippet | |
Unsafe unsafe = (Unsafe) MethodHandles.privateLookupIn(Unsafe.class, MethodHandles.lookup()) | |
.findStaticGetter(Unsafe.class, "theUnsafe", Unsafe.class) | |
.invoke(); | |
unsafe.setMemory(0L, 1L, (byte) 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment