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

Panic when calling set_host with None on URL #243

Closed
frewsxcv opened this issue Dec 2, 2016 · 0 comments
Closed

Panic when calling set_host with None on URL #243

frewsxcv opened this issue Dec 2, 2016 · 0 comments

Comments

@frewsxcv
Copy link
Contributor

frewsxcv commented Dec 2, 2016

let mut url = Url::parse("https://example.net/hello").unwrap();
url.set_host(None).unwrap();
thread 'main' panicked at 'begin <= end (19 <= 6) when slicing `https://example.net/hello`', ../src/libcore/str/mod.rs:1719
stack backtrace:
   1:        0x10d66ffaa - std::sys::imp::backtrace::tracing::imp::write::h383d0c200a1dd210
   2:        0x10d67fd6f - std::panicking::default_hook::{{closure}}::h9445b5c503f9824b
   3:        0x10d67cf2f - std::panicking::default_hook::h36fefcc1f50aa494
   4:        0x10d67d566 - std::panicking::rust_panic_with_hook::hf54dd023dee7ef13
   5:        0x10d67d404 - std::panicking::begin_panic::ha78ff90bed4768ad
   6:        0x10d67d322 - std::panicking::begin_panic_fmt::hc7561fdea0f5f71c
   7:        0x10d67d287 - rust_begin_unwind
   8:        0x10d6bfc10 - core::panicking::panic_fmt::hb7aed24f08b1bad6
   9:        0x10d6c0ae5 - core::str::slice_error_fail::hc148aa73da59a300
  10:        0x10d4d3314 - core::str::traits::<impl core::ops::Index<core::ops::Range<usize>> for str>::index::hc91b0c453a2b9a37
  11:        0x10d4c9474 - <collections::string::String as core::ops::Index<core::ops::Range<usize>>>::index::hfbbcd72b44dfd783
  12:        0x10d4caaba - collections::string::String::drain::h1868f57c1d4390c5
  13:        0x10d4ee1e2 - url::Url::set_host::hcdae4ea78ed9facd
  14:        0x10d4c8ca9 - rust_out::main::ha208b69ccbc11839
  15:        0x10d68032a - __rust_maybe_catch_panic
  16:        0x10d67ddf6 - std::rt::lang_start::h26c24604fceba8d3
  17:        0x10d4c8d89 - main
', ../src/librustdoc/test.rs:315
stack backtrace:
   1:        0x113674faa - std::sys::imp::backtrace::tracing::imp::write::h383d0c200a1dd210
   2:        0x113684d6f - std::panicking::default_hook::{{closure}}::h9445b5c503f9824b
   3:        0x113681e35 - std::panicking::default_hook::h36fefcc1f50aa494
   4:        0x113682566 - std::panicking::rust_panic_with_hook::hf54dd023dee7ef13
   5:        0x113682404 - std::panicking::begin_panic::ha78ff90bed4768ad
   6:        0x113682322 - std::panicking::begin_panic_fmt::hc7561fdea0f5f71c
   7:        0x10f0deaf5 - rustdoc::test::runtest::h9f5d35a4e456f3f0
   8:        0x10efcd420 - <F as test::FnBox<T>>::call_box::hfb4e687f64168832
   9:        0x11368532a - __rust_maybe_catch_panic
  10:        0x10f33bb50 - std::panicking::try::do_call::h7476444272edf7f4
  11:        0x11368532a - __rust_maybe_catch_panic
  12:        0x10f341f9a - <F as alloc::boxed::FnBox<A>>::call_box::hf1758710039efd69
  13:        0x1136813d4 - std::sys::imp::thread::Thread::new::thread_start::hcd65577217ddb0d9
  14:     0x7fffea8beaaa - _pthread_body
  15:     0x7fffea8be9f6 - _pthread_start
bors-servo pushed a commit that referenced this issue Dec 17, 2016
Prevent panic when calling `url::Url::set_host` with `None`.

Fixes #243.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-url/244)
<!-- Reviewable:end -->
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

1 participant