Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed round trip in fuzzer (EmptyHost) #729

Open
5225225 opened this issue Nov 18, 2021 · 1 comment
Open

Failed round trip in fuzzer (EmptyHost) #729

5225225 opened this issue Nov 18, 2021 · 1 comment

Comments

@5225225
Copy link

5225225 commented Nov 18, 2021

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());
    }
});
@yescallop
Copy link

yescallop commented Apr 16, 2022

The fuzzer on 48fcbe1 still ran into this same yet shorter case: A:/.//: .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants