Closed
Description
Symfony version(s) affected: 5.x-dev (latest master)
Description
When trying to parse a certain invalid YAML file, the parser can get stuck in what seems to be an infinite loop, with the worker at 100% CPU utilization. I've let it work for a few minutes to no avail.
How to reproduce
Pass the following string to Yaml::parse()
:
{
"object": {
"array": [
"a",
"b",
"c"
]
],
}
}
Notice the extra ],
. When you remove this line (which may be there due to some simple mistake), the parser handles the document fine.
Possible Solution
No idea what exactly went wrong here, but IMO the parser should implement some sort of short-circuit for infinite loops. That would be especially useful when parsing user-provided content. Maybe add an option to limit the number of iterations?