whatwg / urlpattern

URL Pattern Standard
https://urlpattern.spec.whatwg.org/
Other
154 stars 20 forks source link

"Hostname pattern is an IPv6 address" called with `null` #209

Closed rubycon closed 7 months ago

rubycon commented 7 months ago

What is the issue with the URL Pattern Standard?

The hostname pattern is an IPv6 address steps except a pattern string but in the initialize steps it can directly be called with null when hostname isn't present in the argument passed to the constructor :

  1. If the result running hostname pattern is an IPv6 address given processedInit["hostname"] is true, then...

The hostname pattern is an IPv6 address steps then fail to check its null input code point length:

  1. If input’s code point length is less than 2, then return false.

This issue is related the null default value issue discussed here

jeremyroman commented 7 months ago

Yes, this algorithm assumes that getting the value of a map returns null for absent entries, but that's not what map/get does (it asserts that the entry is present). Let me see what the simplest way to fix that is.