ImageOnMap

ImageOnMap

148k Downloads

User input data is not sterilized for image dimensions.

ShibeTemple opened this issue ยท 2 comments

commented

User input data is not sterilized for image dimensions, causing a main server thread crash due to watchdog hang. Log provided below, simplified with only relevant information like the stack trace.

[03:44:05 INFO]: Noitnettaa issued server command: /maptool new https://cdn.discordapp.com/attachments/809679529903390731/811549628654551050/Snapchat-1148687832.jpg resize 200 200'
[03:44:05 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'maptool' in plugin ImageOnMap v4.0
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[patched_1.16.5.jar:git-Paper-468]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159) ~[patched_1.16.5.jar:git-Paper-468]
        at org.bukkit.craftbukkit.v1_16_R3.CraftServer.dispatchCommand(CraftServer.java:806) ~[patched_1.16.5.jar:git-Paper-468]
        at net.minecraft.server.v1_16_R3.PlayerConnection.handleCommand(PlayerConnection.java:2021) ~[?:git-Paper-468]
        at net.minecraft.server.v1_16_R3.PlayerConnection.c(PlayerConnection.java:1832) ~[?:git-Paper-468]
        at net.minecraft.server.v1_16_R3.PlayerConnection.a(PlayerConnection.java:1785) ~[?:git-Paper-468]
        at net.minecraft.server.v1_16_R3.PacketPlayInChat.a(PacketPlayInChat.java:47) ~[patched_1.16.5.jar:git-Paper-468]
        at net.minecraft.server.v1_16_R3.PacketPlayInChat.a(PacketPlayInChat.java:5) ~[patched_1.16.5.jar:git-Paper-468]
        at net.minecraft.server.v1_16_R3.PlayerConnectionUtils.lambda$ensureMainThread$1(PlayerConnectionUtils.java:23) ~[patched_1.16.5.jar:git-Paper-468]
        at net.minecraft.server.v1_16_R3.TickTask.run(SourceFile:18) ~[patched_1.16.5.jar:git-Paper-468]
        at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeTask(IAsyncTaskHandler.java:136) ~[patched_1.16.5.jar:git-Paper-468]
        at net.minecraft.server.v1_16_R3.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) ~[patched_1.16.5.jar:git-Paper-468]
        at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.executeNext(IAsyncTaskHandler.java:109) ~[patched_1.16.5.jar:git-Paper-468]
        at net.minecraft.server.v1_16_R3.MinecraftServer.bb(MinecraftServer.java:1133) ~[patched_1.16.5.jar:git-Paper-468]
        at net.minecraft.server.v1_16_R3.MinecraftServer.executeNext(MinecraftServer.java:1126) ~[patched_1.16.5.jar:git-Paper-468]
        at net.minecraft.server.v1_16_R3.IAsyncTaskHandler.awaitTasks(IAsyncTaskHandler.java:119) ~[patched_1.16.5.jar:git-Paper-468]
        at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1200) ~[patched_1.16.5.jar:git-Paper-468]
        at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:997) ~[patched_1.16.5.jar:git-Paper-468]
        at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:174) ~[patched_1.16.5.jar:git-Paper-468]
        at java.lang.Thread.run(Unknown Source) [?:?]
Caused by: java.lang.NumberFormatException: For input string: "200'"
        at java.lang.NumberFormatException.forInputString(Unknown Source) ~[?:?]
        at java.lang.Integer.parseInt(Unknown Source) ~[?:?]
        at java.lang.Integer.parseInt(Unknown Source) ~[?:?]
        at fr.moribus.imageonmap.commands.maptool.NewCommand.run(NewCommand.java:86) ~[?:?]
        at fr.moribus.imageonmap.components.commands.Command.execute(Command.java:167) ~[?:?]
        at fr.moribus.imageonmap.components.commands.CommandGroup.executeMatchingCommand(CommandGroup.java:171) ~[?:?]
        at fr.moribus.imageonmap.components.commands.CommandGroup.executeMatchingCommand(CommandGroup.java:163) ~[?:?]
        at fr.moribus.imageonmap.components.commands.CommandGroup.onCommand(CommandGroup.java:189) ~[?:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[patched_1.16.5.jar:git-Paper-468]
        ... 19 more
[03:44:19 ERROR]: --- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH  - git-Paper-468 (MC: 1.16.5) ---```
[03:44:20 ERROR]: ------------------------------
[03:44:20 ERROR]: Server thread dump (Look for plugins here before reporting to Paper!):
[03:44:22 ERROR]: ------------------------------
[03:44:22 ERROR]: Current Thread: Server thread
[03:44:22 ERROR]:       PID: 26 | Suspended: false | Native: false | State: RUNNABLE
[03:44:22 ERROR]:       Stack:
[03:44:22 ERROR]:               app//net.minecraft.server.v1_16_R3.WorldMap.<init>(WorldMap.java:32)
[03:44:22 ERROR]:               app//net.minecraft.server.v1_16_R3.ItemWorldMap.a(ItemWorldMap.java:51)
[03:44:22 ERROR]:               app//net.minecraft.server.v1_16_R3.ItemWorldMap.getSavedMap(ItemWorldMap.java:37)
[03:44:22 ERROR]:               app//org.bukkit.craftbukkit.v1_16_R3.CraftServer.createMap(CraftServer.java:1482)
[03:44:22 ERROR]:               app//org.bukkit.craftbukkit.v1_16_R3.CraftServer.createMap(CraftServer.java:233)
[03:44:22 ERROR]:               app//org.bukkit.Bukkit.createMap(Bukkit.java:658)
[03:44:22 ERROR]:               fr.moribus.imageonmap.map.MapManager.getNewMapsIds(MapManager.java:131)
[03:44:22 ERROR]:               fr.moribus.imageonmap.image.ImageRendererExecutor$4.call(ImageRendererExecutor.java:154)
[03:44:22 ERROR]:               fr.moribus.imageonmap.image.ImageRendererExecutor$4.call(ImageRendererExecutor.java:150)
[03:44:22 ERROR]:               fr.moribus.imageonmap.components.worker.WorkerMainThreadExecutor$WorkerFuture.runCallable(WorkerMainThreadExecutor.java:108)
[03:44:22 ERROR]:               fr.moribus.imageonmap.components.worker.WorkerMainThreadExecutor.run(WorkerMainThreadExecutor.java:88)
[03:44:22 ERROR]:               app//org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:100)
[03:44:22 ERROR]:               app//org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:468)
[03:44:22 ERROR]:               app//net.minecraft.server.v1_16_R3.MinecraftServer.b(MinecraftServer.java:1294)
[03:44:22 ERROR]:               app//net.minecraft.server.v1_16_R3.DedicatedServer.b(DedicatedServer.java:377)
[03:44:22 ERROR]:               app//net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1209)
[03:44:22 ERROR]:               app//net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:997)
[03:44:22 ERROR]:               app//net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:174)
[03:44:22 ERROR]:               app//net.minecraft.server.v1_16_R3.MinecraftServer$$Lambda$3151/0x00000008016e5840.run(Unknown Source)
[03:44:22 ERROR]:               [email protected]/java.lang.Thread.run(Unknown Source)
[03:44:22 ERROR]: ------------------------------
[03:44:22 ERROR]: --- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH ---
[03:44:22 ERROR]: ------------------------------
[03:44:24 ERROR]: --- DO NOT REPORT THIS TO PAPER - THIS IS NOT A BUG OR A CRASH  - git-Paper-468 (MC: 1.16.5) ---
[03:44:24 ERROR]: The server has not responded for 15 seconds! Creating thread dump
[03:44:24 ERROR]: ------------------------------
[03:44:24 ERROR]: Server thread dump (Look for plugins here before reporting to Paper!):
[03:44:24 ERROR]: ------------------------------
[03:44:24 ERROR]: Current Thread: Server thread
[03:44:24 ERROR]:       PID: 26 | Suspended: false | Native: false | State: RUNNABLE
[03:44:24 ERROR]:       Stack:
[03:44:24 ERROR]:               [email protected]/java.lang.Object.hashCode(Native Method)
[03:44:24 ERROR]:               [email protected]/java.util.HashMap.hash(Unknown Source)
[03:44:24 ERROR]:               [email protected]/java.util.HashMap.put(Unknown Source)
[03:44:24 ERROR]:               app//org.bukkit.craftbukkit.v1_16_R3.map.CraftMapView.addRenderer(CraftMapView.java:103)
[03:44:24 ERROR]:               app//org.bukkit.craftbukkit.v1_16_R3.map.CraftMapView.<init>(CraftMapView.java:29)
[03:44:24 ERROR]:               app//net.minecraft.server.v1_16_R3.WorldMap.<init>(WorldMap.java:50)
[03:44:24 ERROR]:               app//net.minecraft.server.v1_16_R3.ItemWorldMap.a(ItemWorldMap.java:51)
[03:44:24 ERROR]:               app//net.minecraft.server.v1_16_R3.ItemWorldMap.getSavedMap(ItemWorldMap.java:37)
[03:44:24 ERROR]:               app//org.bukkit.craftbukkit.v1_16_R3.CraftServer.createMap(CraftServer.java:1482)
[03:44:24 ERROR]:               app//org.bukkit.craftbukkit.v1_16_R3.CraftServer.createMap(CraftServer.java:233)
[03:44:24 ERROR]:               app//org.bukkit.Bukkit.createMap(Bukkit.java:658)
[03:44:24 ERROR]:               fr.moribus.imageonmap.map.MapManager.getNewMapsIds(MapManager.java:131)
[03:44:24 ERROR]:               fr.moribus.imageonmap.image.ImageRendererExecutor$4.call(ImageRendererExecutor.java:154)
[03:44:24 ERROR]:               fr.moribus.imageonmap.image.ImageRendererExecutor$4.call(ImageRendererExecutor.java:150)
[03:44:24 ERROR]:               fr.moribus.imageonmap.components.worker.WorkerMainThreadExecutor$WorkerFuture.runCallable(WorkerMainThreadExecutor.java:108)
[03:44:24 ERROR]:               fr.moribus.imageonmap.components.worker.WorkerMainThreadExecutor.run(WorkerMainThreadExecutor.java:88)
[03:44:24 ERROR]:               app//org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:100)
[03:44:24 ERROR]:               app//org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:468)
[03:44:24 ERROR]:               app//net.minecraft.server.v1_16_R3.MinecraftServer.b(MinecraftServer.java:1294)
[03:44:25 ERROR]:               app//net.minecraft.server.v1_16_R3.DedicatedServer.b(DedicatedServer.java:377)
[03:44:25 ERROR]:               app//net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1209)
[03:44:25 ERROR]:               app//net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:997)
[03:44:25 ERROR]:               app//net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:174)
[03:44:25 ERROR]:               app//net.minecraft.server.v1_16_R3.MinecraftServer$$Lambda$3151/0x00000008016e5840.run(Unknown Source)
[03:44:25 ERROR]:               [email protected]/java.lang.Thread.run(Unknown Source)```
commented

Will be fixed in 4.1.3

commented

PR #173 should fix this issue.