Panic in `Url::set_host`
Open
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.6k
- Forks
- 406
- PR merge metrics
- No merged PRs in 30d
Description
While working on creating a more extensive fuzzing target as in https://github.com/servo/rust-url/issues/654 I found this panic:
#[test]
let mut url = Url::parse("\nx--n://\u{b}#.").unwrap();
dbg!(&url);
/*
Url {
scheme: "x--n",
host: Some(
Domain(
"%0B",
),
),
port: None,
path: "",
query: None,
fragment: Some(
".",
),
username: "",
password: None,
}
*/
url.set_host(None).unwrap();
panicked at 'assertion failed: self.byte_at(self.path_start) == b'/'', url/src/lib.rs:1685:13
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproducer in the issue and inspect url/src/lib.rs around line 1685, where Url::set_host(None) triggers the assertion. Trace how the parsed URL's host, path, and path_start are represented before set_host runs. Done means the reproducer no longer panics and a regression test covers this input.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100