diff --git a/src/host.rs b/src/host.rs index 98c8bdfc..20e8a777 100644 --- a/src/host.rs +++ b/src/host.rs @@ -101,6 +101,11 @@ impl Ipv6Address { let mut piece_pointer = 0; let mut compress_pointer = None; let mut i = 0; + + if len < 2 { + return Err(ParseError::InvalidIpv6Address) + } + if input[0] == b':' { if input[1] != b':' { return Err(ParseError::InvalidIpv6Address) diff --git a/src/urltestdata.txt b/src/urltestdata.txt index ce704df9..ece4e713 100644 --- a/src/urltestdata.txt +++ b/src/urltestdata.txt @@ -267,6 +267,10 @@ http://Goo%20\sgoo%7C|.com # This should fail http://GOO\u00a0\u3000goo.com +# This should fail +http://[] +http://[:] + # Other types of space (no-break, zero-width, zero-width-no-break) are # name-prepped away to nothing. XFAIL http://GOO\u200b\u2060\ufeffgoo.com s:http p:/ h:googoo.com