Bukkit/CraftBukkit — pull request #1168 by smith61 (2013-06-04 20:18:22+00:00)
Title: [C] Fixes StackOverFlowError while reading NBT Tags

The Issue:
Malformed NBT streams can cause a StackOverFlowError to be thrown while reading

Justification for this PR:
There are times when malformed data can cause the server to crash and become unresponsive to clients. I won't post the specific paths to causing this but if it is needed my bukkit forum account is smith_61. Drop me a pm and I can describe in more detail.

PR Breakdown:
This change adds a counter to the NBTBase and NBTList class that records the current depth. If the depth reaches 100 it throws an NBTStackSignal that signals the root method call that the NBT stack overflowed and the read was aborted.
In NBTBase this causes it to return a new NBTTagCompound and in NBTTagList this causes it to exit the load method