-
Notifications
You must be signed in to change notification settings - Fork 358
Open
Description
- Note that this crate implements the URL Standard not RFC 1738 or RFC 3986
Describe the bug
There appears to be an assertion failure in the index function in the url/src/slicing.rs file.
Error message and stack backtrace
running 1 test
test fast_test2 ... FAILED
successes:
successes:
failures:
---- fast_test2 stdout ----
test="http://userDpass@mozilla.org"
sliced: ""
sliced: "http"
sliced: "http://"
sliced: "http://userDpass"
thread 'fast_test2' panicked at url/src/slicing.rs:147:21:
assertion failed: self.username_end == self.host_start
stack backtrace:
0: rust_begin_unwind
at /rustc/5069856495870486134dd2ca0b0e2516308c5c2a/library/std/src/panicking.rs:665:5
1: core::panicking::panic_fmt
at /rustc/5069856495870486134dd2ca0b0e2516308c5c2a/library/core/src/panicking.rs:74:14
2: core::panicking::panic
at /rustc/5069856495870486134dd2ca0b0e2516308c5c2a/library/core/src/panicking.rs:148:5
3: url::slicing::<impl url::Url>::index
at ./src/slicing.rs:147:21
4: url::slicing::<impl core::ops::index::Index<core::ops::range::Range<url::slicing::Position>> for url::Url>::index
at ./src/slicing.rs:36:54
5: fuzz_test2::fast_test2
at ./tests/fuzz_test2.rs:120:33
6: fuzz_test2::fast_test2::{{closure}}
at ./tests/fuzz_test2.rs:90:16
7: core::ops::function::FnOnce::call_once
at /rustc/5069856495870486134dd2ca0b0e2516308c5c2a/library/core/src/ops/function.rs:250:5
8: core::ops::function::FnOnce::call_once
at /rustc/5069856495870486134dd2ca0b0e2516308c5c2a/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
failures:
fast_test2
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 2 filtered out; finished in 0.08s
error: test failed, to rerun pass `-p url --test fuzz_test2`
How to reproduce
- select any inputs in the example below
- run the test
let data = "http://userDpass@mozilla.org";
// let data = "httM://userpQass@mozilla.org";
// let data = "https://username;password@www.eample.c/m:8080/p)ath/to/opage?query=example#fragment";
// let data = "https://usernamepassword@wbww.examplencom:080/path/to/page?query=example\"fragmenkt";
// let data = "https://usernamepassword@www.example.com:8280/path/to/page?query=example#fragment";
println!("test={:?}", data);
if let Ok(url) = Url::parse(data) {
let positions = [
Position::BeforeScheme,
Position::AfterScheme,
Position::BeforeUsername,
Position::AfterUsername,
Position::BeforePassword,
Position::AfterPassword,
Position::BeforeHost,
Position::AfterHost,
Position::BeforePort,
Position::AfterPort,
Position::BeforePath,
Position::AfterPath,
Position::BeforeQuery,
Position::AfterQuery,
Position::BeforeFragment,
Position::AfterFragment,
];
// Attempt to create slices of the URL using all "good" combinations of positions
for (i, &start) in positions.iter().enumerate() {
for &end in &positions[i..] {
let slice = &url[start..end];
println!("sliced: {:?}", slice);
}
}
} else {
println!("Invalid URL");
}Metadata
Metadata
Assignees
Labels
No labels