IPAddr.ntop takes the binary representation of an IP address, whose length should be 4 or 16 bytes (not characters/codepoints).
The current implementation accepts strings in any encoding, but for some values in non-BINARY encoding, it fails proper length check and raises an AddressFamilyError. Since passing strings in a multibyte encoding has never worked correctly for years, this patch makes it an explicit error with an InvalidAddressError.
[ruby/ipaddr] ntop: Measure address size in bytes
IPAddr.ntoptakes the binary representation of an IP address, whoselength should be 4 or 16 bytes (not characters/codepoints).
The current implementation accepts strings in any encoding, but for
some values in non-BINARY encoding, it fails proper length check and
raises an
AddressFamilyError. Since passing strings in a multibyteencoding has never worked correctly for years, this patch makes it an
explicit error with an
InvalidAddressError.Fixes: https://github.com/ruby/ipaddr/issues/56
https://github.com/ruby/ipaddr/commit/a33fd14d4a