The bug
Unlike NBT loading, NBT copying does not have an upper bound for depth. For this reason, copying deeply nested NBT may cause java.lang.StackOverflowError
or create an unloadable NBT whose depth is more than 512.
How to reproduce
/data modify storage mc-201769: : set value {}
Run the following command using a repeating command block
data modify storage mc-201769: :.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.: set from storage mc-201769: :
→ ❌ Eventually, the game crashes due to
java.lang.StackOverflowError
.
Attachments
Comments 6
@unknown, please don't abuse bugs in bug tracker itself, it's not helpful whatsoever, and may result in you getting banned
@SunCat oh that was a bug... I had thought that was made available for some reason.
I'll be more careful in future.
This can also be reproduced, albeit much more slowly, with ctrl+picking a chest with an item in it, placing it in another chest, ctrl+picking this second chest and putting it in the first one, and repeating the process which causes extreme lag and eventually crashes.
It is probably the same issue.
Found out that it might not be the same issue, so I created a new ticket for it: MC-237841. Feel free to resolve it as a duplicate.
Affects 1.18.1
New stacktrace:
java.lang.StackOverflowError: Executing command block
at com.google.common.collect.Maps$TransformedEntriesMap.size(Maps.java:2133)
at java.base/java.util.HashMap.putMapEntries(HashMap.java:495)
at java.base/java.util.HashMap.<init>(HashMap.java:484)
at com.google.common.collect.Maps.newHashMap(Maps.java:258)
at oc.g(SourceFile:450)
at oc.c(SourceFile:22)
at com.google.common.collect.Maps$9.transformEntry(Maps.java:2053)
at com.google.common.collect.Maps$12.getValue(Maps.java:2101)
at java.base/java.util.HashMap.putMapEntries(HashMap.java:513)
at java.base/java.util.HashMap.<init>(HashMap.java:484)
at com.google.common.collect.Maps.newHashMap(Maps.java:258)
at oc.g(SourceFile:450)
at oc.c(SourceFile:22)
[...]
That was probably a very naughty thing to do.