samolego / FabricTailor

A server-side or singleplayer skin changing mod for fabric.
https://modrinth.com/mod/FabricTailor
GNU Lesser General Public License v3.0
109 stars 16 forks source link

[BUG] Server crashing behavior 1.20.4-2.3.1 #107

Closed stacksm4sher closed 4 months ago

stacksm4sher commented 4 months ago

Issue

Describe the bug

To Reproduce

Steps to reproduce the behavior:

  1. Provide invalid uri without scheme or other mandatory properties (for example: discord)
  2. Press apply
  3. Mod writes invalid NBT tag
  4. Fetching -> NPE

Logs

[19:16:47] [Render thread/ERROR]:
 Unreported exception thrown!
java.util.concurrent.CompletionException: java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because the return value of "java.net.URI.getScheme()" is null
    at java.util.concurrent.CompletableFuture.encodeThrowable(Unknown Source) ~[?:?]
    at java.util.concurrent.CompletableFuture.completeThrowable(Unknown Source) ~[?:?]
    at java.util.concurrent.CompletableFuture$AsyncSupply.run(Unknown Source) ~[?:?]
    at java.util.concurrent.CompletableFuture$AsyncSupply.exec(Unknown Source) ~[?:?]
    at java.util.concurrent.ForkJoinTask.doExec(Unknown Source) ~[?:?]
    at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source) ~[?:?]
    at java.util.concurrent.ForkJoinPool.scan(Unknown Source) ~[?:?]
    at java.util.concurrent.ForkJoinPool.runWorker(Unknown Source) ~[?:?]
    at java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source) ~[?:?]
Caused by: java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because the return value of "java.net.URI.getScheme()" is null
    at com.mojang.authlib.yggdrasil.TextureUrlChecker.handler$bml000$fabrictailor$ft_allowAllTextureDomains(TextureUrlChecker.java:522) ~[authlib-6.0.52.jar:?]
    at com.mojang.authlib.yggdrasil.TextureUrlChecker.isAllowedTextureDomain(TextureUrlChecker.java:36) ~[authlib-6.0.52.jar:?]
    at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.unpackTextures(YggdrasilMinecraftSessionService.java:150) ~[authlib-6.0.52.jar:?]
    at net.minecraft.class_1071$1.method_54647(class_1071.java:55) ~[client-intermediary.jar:?]
    ... 7 more
samolego commented 4 months ago

Uh, thanks for reporting. Nasty issue.

stacksm4sher commented 4 months ago

I finally reproduced it myself... because my friend was the one who found that bug by setting his skin via cape tab using corrupted uri on my server and crashing everyone on join. He is kinda retarded and was not able to explain what he actually did :D

The skin setting works totally fine even if URI is corrupted. This error is produced by setting the cape. Also i found one more bug:

  1. corrupt player profile
  2. try set skin to default
  3. receive NoSuchElementException

Stacktrace:

java.util.NoSuchElementException
    at com.google.common.collect.LinkedHashMultimap$ValueSet$1.next(LinkedHashMultimap.java:434)
    at com.google.common.collect.AbstractMapBasedMultimap$WrappedCollection$WrappedIterator.next(AbstractMapBasedMultimap.java:473)
    at org.samo_lego.fabrictailor.client.screen.SkinChangeScreen.lambda$init$4(SkinChangeScreen.java:148)
    at net.minecraft.client.gui.components.Button.onPress(Button.java:96)
    at net.minecraft.client.gui.components.AbstractButton.onClick(AbstractButton.java:48)
    at net.minecraft.client.gui.components.AbstractWidget.mouseClicked(AbstractWidget.java:141)
    at net.minecraft.client.gui.components.events.ContainerEventHandler.mouseClicked(ContainerEventHandler.java:38)
    at org.samo_lego.fabrictailor.client.screen.SkinChangeScreen.mouseClicked(SkinChangeScreen.java:381)
    at net.minecraft.client.MouseHandler.method_1611(MouseHandler.java:101)
    at net.minecraft.client.gui.screens.Screen.wrapScreenError(Screen.java:467)
    at net.minecraft.client.MouseHandler.onPress(MouseHandler.java:101)
    at net.minecraft.client.MouseHandler.method_22686(MouseHandler.java:186)
    at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:108)
    at net.minecraft.client.MouseHandler.method_22684(MouseHandler.java:186)
    at org.lwjgl.glfw.GLFWMouseButtonCallbackI.callback(GLFWMouseButtonCallbackI.java:43)
    at org.lwjgl.system.JNI.invokeV(Native Method)
    at org.lwjgl.glfw.GLFW.glfwWaitEventsTimeout(GLFW.java:3509)
    at com.mojang.blaze3d.systems.RenderSystem.limitDisplayFPS(RenderSystem.java:236)
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:1345)
    at net.minecraft.client.Minecraft.run(Minecraft.java:888)
    at net.minecraft.client.main.Main.main(Main.java:265)
    at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470)
    at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)
    at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
    at net.fabricmc.devlaunchinjector.Main.main(Main.java:86)