-
-
Notifications
You must be signed in to change notification settings - Fork 369
Open
Description
- Note that this crate implements the URL Standard not RFC 1738 or RFC 3986
Describe the bug
Summary
Url::set_path can panic on extremely large input due to internal arithmetic overflow (in restore_after_path) instead of returning an error.
Reproduction
use url::Url;
fn main() {
let mut url = Url::parse("http://a/?a#b").unwrap();
let encoded_path_bytes_target = (u32::MAX as usize) - 9;
let input_spaces = encoded_path_bytes_target / 3;
let huge_path = " ".repeat(input_spaces);
url.set_path(&huge_path); // panic (with overflow checks)
}Expected
Graceful failure (e.g., Result error) for oversized input, not panic.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels