Closed oschwald closed 8 years ago
The cause of this is that inet_pton
ignores leading zeros, which causes this module to think things like ::00000000000
are valid IPv6 addresses when using the fast check. This invalid address is then passed to NetAddr::IP->new
, which returns undef
, leading to the exception above.
I attempted to add a check to _fast_is_ipv6
to check if that string had more than four hexadecimal digits in a row, but this ended up making it approximately the same speed as _slow_is_ipv6
according to the benchmark.
Possible solutions:
_fast_is_ipv6
_fast_is_ipv6
if inet_pton
does not have this behaviorAlthough (2) makes sense, if there aren't any or many such platforms, the code would go untested and likely break without anyone noticing.
throws: