Using /kill on yourself while it's on an ItemStack's PDC causes the server to crash

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor
    • None
    • Affects Version/s: None
    • None
    • CraftBukkit version 3580-Spigot-e53686f-5901d58 (MC: 1.19.2) (Implementing API version 1.19.2-R0.1-SNAPSHOT)
    • Yes

      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

          [SPIGOT-7152] Using /kill on yourself while it's on an ItemStack's PDC causes the server to crash

          mfnalex added a comment -

          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.

          mfnalex added a comment - 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.

          mfnalex added a comment -

          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

          ```

          mfnalex added a comment - 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: Right-Click air in survival works Right-Click block in survival works Right-click air in creative CRASHES 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 ```

            Assignee:
            Unassigned
            Reporter:
            Optic_Fusion1
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: