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.
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
Expected
Graceful failure (e.g., Result error) for oversized input, not panic.