[SPIGOT-7152] Using /kill on yourself while it's on an ItemStack's PDC causes the server to crash Created: 10/Sep/22  Updated: 25/Dec/24  Resolved: 12/Sep/22

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Optic_Fusion1 Assignee: Unassigned
Resolution: Fixed Votes: 1
Labels: None

Attachments: File Crash.jar    
Version: CraftBukkit version 3580-Spigot-e53686f-5901d58 (MC: 1.19.2) (Implementing API version 1.19.2-R0.1-SNAPSHOT)
Guidelines Read: Yes

 Description   

If a plugin uses the PlayerInteractEvent to execute commands that are stored on an ItemStack's PDC it works fine. HOWEVER if the command that gets executed is either kill @e[type=player] OR kill <your_player_name> and you execute it while in creative mode it causes a crash with the following exception: https://paste.md-5.net/eqaqupayeh.md. Another interesting thing is if you do player.setHealth(0) within the PlayerInteractEvent or even the two mentioned commands w/o it being on the PDC it works as expected.

A temp fix is cancelling the PlayerInteractEvent, however on the off chance said fix is not applied then it should be fixed at the source.

While this is limited to creative mode only, this is a possible exploit that could happen on creative mode servers.

steps to replicate:
1) Type ==test
2) Right click block, it works as expected
3) Type == test again
3) Right click air, kill server

Video of crash and steps taken to repoduce w/ the provided plugin: https://www.youtube.com/watch?v=EsS3ZH0d7Mw



 Comments   
Comment by mfnalex [ 10/Sep/22 ]

Another thing I want to mention: on Paper `git-Paper-141 (MC: 1.19.2) (Implementing API version 1.19.2-R0.1-SNAPSHOT) (Git: 51183af)`, this does NOT happen. Everything works fine there. All versions mentioned are the latest as of right now.

Comment by mfnalex [ 10/Sep/22 ]

I can confirm that the .jar Optic_Fusion sent also crashes for me on Spigot `CraftBukkit version 3580-Spigot-e53686f-5901d58 (MC: 1.19.2) (Implementing API version 1.19.2-R0.1-SNAPSHOT)` and also on CraftBukkit `CraftBukkit version 3580-Bukkit-5901d58 (MC: 1.19.2) (Implementing API version 1.19.2-R0.1-SNAPSHOT)`

 

I wanna add this:

  1. Right-Click air in survival works
  2. Right-Click block in survival works
  3. Right-click air in creative CRASHES
  4. Right-click block in creative works

 

Here's the full stacktrace of the crash:

```

[05:37:02] Async Chat Thread - #2/INFO: [Not Secure] <mfnalex> ==test
[05:37:03] [Server thread/INFO]: mfnalex fell out of the world
[05:37:03] [Server thread/INFO]: [mfnalex: Killed mfnalex]
[05:37:03] [Server thread/ERROR]: Encountered an unexpected exception
java.lang.AssertionError: TRAP
        at net.minecraft.world.item.ItemStack.P(ItemStack.java:194) ~[craftbukkit-1.19.2-R0.1-SNAPSHOT.jar:3580-Bukkit-5901d58]
        at net.minecraft.world.item.ItemStack.e(ItemStack.java:1190) ~[craftbukkit-1.19.2-R0.1-SNAPSHOT.jar:3580-Bukkit-5901d58]
        at net.minecraft.server.level.PlayerInteractManager.a(PlayerInteractManager.java:453) ~[craftbukkit-1.19.2-R0.1-SNAPSHOT.jar:3580-Bukkit-5901d58]
        at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1688) ~[craftbukkit-1.19.2-R0.1-SNAPSHOT.jar:3580-Bukkit-5901d58]
        at net.minecraft.network.protocol.game.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:30) ~[craftbukkit-1.19.2-R0.1-SNAPSHOT.jar:3580-Bukkit-5901d58]
        at net.minecraft.network.protocol.game.PacketPlayInBlockPlace.a(PacketPlayInBlockPlace.java:1) ~[craftbukkit-1.19.2-R0.1-SNAPSHOT.jar:3580-Bukkit-5901d58]
        at net.minecraft.network.protocol.PlayerConnectionUtils.lambda$0(PlayerConnectionUtils.java:31) ~[craftbukkit-1.19.2-R0.1-SNAPSHOT.jar:3580-Bukkit-5901d58]
        at net.minecraft.server.TickTask.run(SourceFile:18) ~[craftbukkit-1.19.2-R0.1-SNAPSHOT.jar:3580-Bukkit-5901d58]
        at net.minecraft.util.thread.IAsyncTaskHandler.d(SourceFile:157) ~[craftbukkit-1.19.2-R0.1-SNAPSHOT.jar:3580-Bukkit-5901d58]
        at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.d(SourceFile:23) ~[craftbukkit-1.19.2-R0.1-SNAPSHOT.jar:3580-Bukkit-5901d58]
        at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1109) ~[craftbukkit-1.19.2-R0.1-SNAPSHOT.jar:3580-Bukkit-5901d58]
        at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:1) ~[craftbukkit-1.19.2-R0.1-SNAPSHOT.jar:3580-Bukkit-5901d58]
        at net.minecraft.util.thread.IAsyncTaskHandler.x(SourceFile:131) ~[craftbukkit-1.19.2-R0.1-SNAPSHOT.jar:3580-Bukkit-5901d58]
        at net.minecraft.server.MinecraftServer.bh(MinecraftServer.java:1088) ~[craftbukkit-1.19.2-R0.1-SNAPSHOT.jar:3580-Bukkit-5901d58]
        at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1081) ~[craftbukkit-1.19.2-R0.1-SNAPSHOT.jar:3580-Bukkit-5901d58]
        at net.minecraft.util.thread.IAsyncTaskHandler.c(SourceFile:140) ~[craftbukkit-1.19.2-R0.1-SNAPSHOT.jar:3580-Bukkit-5901d58]
        at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1065) ~[craftbukkit-1.19.2-R0.1-SNAPSHOT.jar:3580-Bukkit-5901d58]
        at net.minecraft.server.MinecraftServer.v(MinecraftServer.java:983) ~[craftbukkit-1.19.2-R0.1-SNAPSHOT.jar:3580-Bukkit-5901d58]
        at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:285) ~[craftbukkit-1.19.2-R0.1-SNAPSHOT.jar:3580-Bukkit-5901d58]
        at java.lang.Thread.run(Thread.java:833) [?:?]
[05:37:03] [Server thread/ERROR]: This crash report has been saved to: C:\mctest\.\crash-reports\crash-2022-09-10_05.37.03-server.txt
[05:37:03] [Server thread/INFO]: Stopping server

```

Generated at Sun Mar 30 18:01:24 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.