Skip to content
This repository was archived by the owner on Mar 25, 2024. It is now read-only.
This repository was archived by the owner on Mar 25, 2024. It is now read-only.

"[".repeat(N) takes superlinear time to parse #26

@dtolnay

Description

@dtolnay

Reported by Christian Dürr by email:

Description

I just ran a fuzzer against one of my crates and have come to the realization that certain input causes huge amounts of processing time with serde_yaml::from_str.
In release mode just 100_000 repeated [ cause parsing times of over 15 seconds.

This also applies to the libyaml C library, but since unsafe-libyaml is technically a Rust rewrite I've decided to contact you directly.
It also seems like the C library is unmaintained.

Simple Repro

fn main() {
    let input = "[".repeat(1_000_000);
    let test: String = serde_yaml::from_str(&input).unwrap();
}

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