Skip to content

Failed round trip in fuzzer (EmptyHost) #729

@ghost

Description

The fuzzer on 0840723 found this case which doesn't round-trip.

fn main() {
    let u = url::Url::parse("p:/.//:/").unwrap();
    let s = u.as_str();
    assert_eq!(s, "p://:/"); // the `/.` was lost
    url::Url::parse("p://:/").unwrap(); // which causes this to error
}

Also, the fuzzer can be simplified to not need the UTF-8 check by doing

fuzz_target!(|data: &str| {
    if let Ok(parsed) = url::Url::parse(data) {
        let as_str = parsed.as_str();
        assert_eq!(parsed, url::Url::parse(as_str).unwrap());
    }
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions