mojira.dev
MC-201769

Copying deeply nested NBT causes StackOverflowError

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

  1. /data modify storage mc-201769: : set value {}
  2. 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

That was probably a very naughty thing to do.

@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)
        [...]

intsuc

Panda4994

Confirmed

Very Important

Crash

crash, nbt

1.16.3, 1.16.4 Pre-release 1, 1.16.4, 20w45a, 20w46a, ..., 22w11a, 22w12a, 1.19 Release Candidate 2, 1.19, 1.19.2

1.19.3 Pre-release 3

Retrieved