Limit recursive CHAP and CTOC embedded frame parsing to 64 levels. This prevents crafted ID3v2 tags from exhausting the parser stack. Use one thread-local guard shared by both paths so mixed CHAP and CTOC nesting is bounded as well.
algorithm
std::min
max
std::find_if