Skip to content

Very long execution time while parsing #1967

@lukaslueg

Description

@lukaslueg

Using syn 2.0.115, the fuzzer regurgitated the following, which timed out after around 12 seconds in release-mode and >30 seconds in debug-mode on my machine. I'm not even sure if this is of that much interest, since we can always make things worse by nesting even further than the fuzzer did. The example does demonstrate excessive resource consumption for the given input length, though, and it didn't come up in previous versions of syn; so reported anyway.

fn main() {
    let _ = syn::parse_str::<syn::File>(" fn foo(self: impl foo< {; fn foo(self :[ foo;{ fn foo(self :foo<{ fn foo(self :foo<{ fn foo(self :foo<{ fn foo(self :foo<{; fn foo(self :[ foo;{ fn foo(self :foo<{ fn foo(self :foo<{ fn foo(self :foo<{ fn foo(self :foo<{{foo> {; fn foo(self :[ foo;{ fn foo(self :foo<{ fn foo(self :foo<{ fn foo(self :foo<{ fn foo(self :foo<{; fn foo(self :[ foo;{ fn foo(self :foo<{ fn foo(self :foo<{ fn foo(self :foo<{ fn foo(self :foo<{{foo> while {;}(){}}}>)}>)}>)}>)} while {;}(){}])}>)}>)}>)}>){}}])}}}>)}>)}>)}>)}])}>)}>)}>)}>)}])}>)");
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions