mojira.dev
MC-101120

Sign items with invalid JSON in Text1 tag are used in creative

When giving a player on creative mode a sign with the following command
/give @p sign 10 0 {BlockEntityTag:{Text1:"1"}}
the sign will act strange. This will only occur when the value for Text1 is invalid JSON.

Once you have the sign, just place it down and see the number of signs in the stack go down to 1 in the stack, then MC-105982 blocks it.

Other tags I have tried didn't result in the issue occurring.

Upon dropping the negative signs, you can't pick them up (as I would expect with the way picking up items is processed)


Code analysis by @unknown can be found in this comment.

Environment

Details:
Minecraft Version: 1.9.2
Operating System: Windows 10 (amd64) version 10.0
Java Version: 1.8.0_25, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 146356432 bytes (139 MB) / 255328256 bytes (243 MB) up to 1029177344 bytes (981 MB)
JVM Flags: 3 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx1G -Xmn128M
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
Launched Version: 1.9.2
LWJGL: 2.9.4
OpenGL: Intel(R) HD Graphics 4200 GL version 4.3.0 - Build 20.19.15.4331, Intel
GL Caps: Using GL 1.3 multitexturing.
Using GL 1.3 texture combiners.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Shaders are available because OpenGL 2.1 is supported.
VBOs are available because OpenGL 1.5 is supported.

Using VBOs: Yes
Is Modded: Probably not. Jar signature remains and client brand is untouched.
Type: Client (map_client.txt)
Resource Packs:
Current Language: English (US)
Profiler Position: N/A (disabled)
CPU: 4x Intel(R) Core(TM) i3-4010Y CPU @ 1.30GHz

Linked issues

Attachments

Comments 6

Please link to this comment in the description

The following is based on a decompiled version of Minecraft 1.9 using MCP 9.24 beta.

It looks like the reason why this happens is because the method net.minecraft.item.ItemSign.onItemUse(ItemStack, EntityPlayer, World, BlockPos, EnumHand, EnumFacing, float, float, float) is not catching the exception. Because of this the methods net.minecraft.client.multiplayer.PlayerControllerMP.func_187099_a(EntityPlayerSP, WorldClient, ItemStack, BlockPos, EnumFacing, Vec3d, EnumHand) and net.minecraft.server.management.PlayerInteractionManager.func_187251_a(EntityPlayer, World, ItemStack, EnumHand, BlockPos, EnumFacing, float, float, float) cannot restore the item count and damage for creative players.

I've also noticed that if you put nothing in the Text1 (such as Text1:"") it doesn't do this

Can confirm for 1.10

Fixed for 16w36a
If you place the sign, you get this error in logs:

[21:25:50] [Server thread/FATAL]: Error executing task
java.util.concurrent.ExecutionException: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1
	at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_25]
	at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_25]
	at h.a(SourceFile:46) [16w36a.jar:?]
	at net.minecraft.server.MinecraftServer.D(SourceFile:605) [16w36a.jar:?]
	at net.minecraft.server.MinecraftServer.C(SourceFile:561) [16w36a.jar:?]
	at cal.C(SourceFile:154) [16w36a.jar:?]
	at net.minecraft.server.MinecraftServer.run(SourceFile:465) [16w36a.jar:?]
	at java.lang.Thread.run(Thread.java:745) [?:1.8.0_25]
Caused by: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1
	at com.google.gson.internal.Streams.parse(Streams.java:56) ~[gson-2.2.4.jar:?]
	at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:54) ~[gson-2.2.4.jar:?]
	at oi.a(SourceFile:489) ~[16w36a.jar:?]
	at oi.a(SourceFile:500) ~[16w36a.jar:?]
	at fa$a.a(SourceFile:205) ~[16w36a.jar:?]
	at arv.a(SourceFile:111) ~[16w36a.jar:?]
	at add.a(SourceFile:91) ~[16w36a.jar:?]
	at afp.a(SourceFile:55) ~[16w36a.jar:?]
	at aer.a(SourceFile:177) ~[16w36a.jar:?]
	at lx.a(SourceFile:340) ~[16w36a.jar:?]
	at mg.a(SourceFile:624) ~[16w36a.jar:?]
	at jl.a(SourceFile:55) ~[16w36a.jar:?]
	at jl.a(SourceFile:11) ~[16w36a.jar:?]
	at fn$1.run(SourceFile:13) ~[16w36a.jar:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_25]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_25]
	at h.a(SourceFile:45) ~[16w36a.jar:?]
	... 5 more
Caused by: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1
	at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1505) ~[gson-2.2.4.jar:?]
	at com.google.gson.stream.JsonReader.checkLenient(JsonReader.java:1386) ~[gson-2.2.4.jar:?]
	at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:572) ~[gson-2.2.4.jar:?]
	at com.google.gson.stream.JsonReader.peek(JsonReader.java:414) ~[gson-2.2.4.jar:?]
	at com.google.gson.internal.Streams.parse(Streams.java:42) ~[gson-2.2.4.jar:?]
	at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:54) ~[gson-2.2.4.jar:?]
	at oi.a(SourceFile:489) ~[16w36a.jar:?]
	at oi.a(SourceFile:500) ~[16w36a.jar:?]
	at fa$a.a(SourceFile:205) ~[16w36a.jar:?]
	at arv.a(SourceFile:111) ~[16w36a.jar:?]
	at add.a(SourceFile:91) ~[16w36a.jar:?]
	at afp.a(SourceFile:55) ~[16w36a.jar:?]
	at aer.a(SourceFile:177) ~[16w36a.jar:?]
	at lx.a(SourceFile:340) ~[16w36a.jar:?]
	at mg.a(SourceFile:624) ~[16w36a.jar:?]
	at jl.a(SourceFile:55) ~[16w36a.jar:?]
	at jl.a(SourceFile:11) ~[16w36a.jar:?]
	at fn$1.run(SourceFile:13) ~[16w36a.jar:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_25]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_25]
	at h.a(SourceFile:45) ~[16w36a.jar:?]
	... 5 more

migrated

(Unassigned)

Confirmed

BlockEntityTag, InvalidFormat, Items, JSON, Signs

Minecraft 1.9.2, Minecraft 1.9.3 Pre-Release 1, Minecraft 1.10, Minecraft 16w33a

Minecraft 16w36a

Retrieved