Mojira Archive
MC-188792

Server crash with JsonParseException when using a mob spawn egg with invalid custom name

Related, but not the same as MC-173669 (that was resolved since 1.16 pre3).

The server crash if a mob with some invalid NBT are spawned using a dispenser. I found that while testing the resolution of MC-173669. The difference with the other bug report is that the tag is valid Json, so JsonSyntaxException and MalformedJsonException are not thrown anymore. Instead, we have a JsonParseException.

This can be harmful for creative server, since players can generate any item they want, with any NBT inside.

This bug is also reproducible in single player, making Minecraft crash completely.

How to reproduce

  • Give yourself this creeper egg :
    • /give @p minecraft:creeper_spawn_egg{EntityTag:{CustomName:" {\"thisIsJson\":\"butThisWillCrashTheServer\"}

      ",CustomNameVisible:1}} 1

  • Put the egg in a dispenser.
  • Activate that dispenser with a lever.
  • The server will crash and a crash report will be generated

Here are 3 crash report from 1.15.2 (single player) and 1.16-pre4 (single player + dedicated server)

Description: Loading entity NBT

com.google.gson.JsonParseException: Don't know how to turn {"useless":"JsonData"} into a Component
	at mr$a.a(SourceFile:223)
	at mr$a.deserialize(SourceFile:134)
	at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:69)
	at adt.a(SourceFile:493)
	at adt.a(SourceFile:517)
	at mr$a.a(SourceFile:354)
	at aol.f(SourceFile:1606)
	at aop.a(SourceFile:392)
	at aop.b(SourceFile:359)
	at aop.a(SourceFile:317)
	at aop.a(SourceFile:308)
	at gv$25.a(SourceFile:193)
	at gu.dispense(SourceFile:15)
	at bxc.a(SourceFile:89)
	at bxc.a(SourceFile:112)
	at cfi$a.a(SourceFile:865)
	at zd.b(SourceFile:596)
	at bqn.b(SourceFile:84)
	at zd.a(SourceFile:351)
	at net.minecraft.server.MinecraftServer.b(SourceFile:873)
	at yd.b(SourceFile:306)
	at net.minecraft.server.MinecraftServer.a(SourceFile:813)
	at net.minecraft.server.MinecraftServer.v(SourceFile:672)
	at net.minecraft.server.MinecraftServer.a(SourceFile:256)
	at java.lang.Thread.run(Unknown Source)
Description: Loading entity NBT

com.google.gson.JsonParseException: Don't know how to turn {"thisIsJson":"butThisWillCrashTheServer"} into a Component
	at lf$a.a(SourceFile:267)
	at lf$a.deserialize(SourceFile:175)
	at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:69)
	at abk.a(SourceFile:494)
	at abk.a(SourceFile:519)
	at lf$a.a(SourceFile:399)
	at akq.f(SourceFile:1571)
	at aku.a(SourceFile:370)
	at aku.b(SourceFile:337)
	at aku.a(SourceFile:295)
	at aku.a(SourceFile:286)
	at gl$22.a(SourceFile:186)
	at gk.dispense(SourceFile:15)
	at bqr.a(SourceFile:94)
	at bqr.a(SourceFile:117)
	at byj.a(SourceFile:263)
	at xd.b(SourceFile:584)
	at xd$$Lambda$2900/290369163.accept(Unknown Source)
	at bkj.b(SourceFile:87)
	at xd.a(SourceFile:328)
	at net.minecraft.server.MinecraftServer.b(SourceFile:854)
	at net.minecraft.server.MinecraftServer.a(SourceFile:793)
	at edm.a(SourceFile:130)
	at net.minecraft.server.MinecraftServer.run(SourceFile:655)
	at java.lang.Thread.run(Thread.java:745)

Fixed

Marc Baloup

[Mojang] Bartosz Bok

2020-06-12, 02:12 AM

2020-06-12, 02:33 PM

2020-06-12, 02:33 PM

0

0

Confirmed

Crash, Items

1.15.2, 1.16 Pre-release 4

1.16 Pre-release 5