Skip to content

Assertion failed: self.serialization.ends_with('/') when joining on file:// url #395

Open
@mateon1

Description

@mateon1

Found while fuzzing Servo, here's a minimal example that hits the panic:

#[test]
fn issue_395() {
    let file = Url::parse("file:///t:").unwrap();
    let _ = file.join("8"); // panic!
}

Panic stack trace:

thread 'issue_395' panicked at 'assertion failed: self.serialization.ends_with('/')', src/parser.rs:884:8
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
             at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at /checkout/src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at /checkout/src/libstd/sys_common/backtrace.rs:60
             at /checkout/src/libstd/panicking.rs:381
   3: std::panicking::default_hook
             at /checkout/src/libstd/panicking.rs:397
   4: std::panicking::rust_panic_with_hook
             at /checkout/src/libstd/panicking.rs:577
   5: std::panicking::begin_panic
             at /checkout/src/libstd/panicking.rs:538
   6: url::parser::Parser::parse_path
             at src/parser.rs:884
   7: url::parser::Parser::parse_file
             at src/parser.rs:548
   8: url::parser::Parser::parse_url
             at src/parser.rs:276
   9: url::ParseOptions::parse
             at src/lib.rs:220
  10: url::Url::join
             at ./src/lib.rs:340
  11: unit::issue_395
             at tests/unit.rs:485
  12: core::ops::function::FnMut::call_mut
             at /checkout/src/libcore/ops/function.rs:146
  13: test::run_test::run_test_inner::{{closure}}::{{closure}}
             at /home/mateon/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-test-0.2.0/src/lib.rs:1168

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions