The vulnerability lies in the Symfony YAML component's parser, which was susceptible to uncontrolled recursion when handling deeply nested YAML structures. This could lead to a denial-of-service (DoS) due to stack exhaustion. The analysis of the provided patch commit reveals that the core of the vulnerability was in the Parser::parseBlock, Inline::parseSequence, and Inline::parseMapping functions. These functions, responsible for parsing different parts of the YAML syntax, would recursively call themselves or each other without any limit on the nesting depth.
The fix introduces a ParserState object that is shared across the parsing process to track the current nesting level. A maximum nesting depth is now enforced (defaulting to 128). The vulnerable functions parseBlock, parseSequence, and parseMapping were modified to check this nesting level before proceeding with recursion, throwing a ParseException if the limit is exceeded. The main entry points for the parser, Yaml::parse and Yaml::parseFile, were also updated to allow configuration of this new maximum nesting level.