Pizza recursion overloads NBT
fengshuo2004 opened this issue ยท 3 comments
Description
It turns out that this mod and Some Assembly Required both saves the full NBT data of ingredients inside the pizza/sandwich items. This means by putting a pizza inside a sandwich inside a pizza inside a sandwich inside a pizza... you obtain an item with gigantic amount of NBT data that would crash the client as soon as it's placed into a tile entity.
A friend on my server found this out the hard way. At this point, the pizza is inside a pizza station. Anyone close enough to load that chunk is kicked instantly and couldn't rejoin. This is effectively a chunk ban. We had to reset the entity data of the pizza station using a NBT editor.
Here's a picture of the sandwich one step before wreaking havoc:
To reproduce
- Create sandwich using the sandwich station (from mod Some Assembly Required)
- Put sandwiches into pizza station's ingredient slots
- Create and cook the pizza
- Slice the pizza and put the slices inside another sandwich
- Repeat 2-4 until 9 sandwiches
- Place back into the pizza station, you are instantly kicked along other players in chunk loading range
Potential Fix
IMO the best fix would be to store the ID of ingredients inside the pizza without copying all their NBT data.
I've had a look at your code, in this function:
It calls NBTUtils.saveInventoryToStack()
which seems to do a deep copy of the ingredients' data. You might want to change this to only copy the item ID instead.
Thanks.
@Tiviacz1337 Hi. Please re-open this issue. It turns out Some Assembly Required is not the cause here. You can still crash client side by putting pizza inside a pizza inside a pizza inside a pizza... The NBT data of pizza ingredients MUST be sanitized to properly fix this.