RFR 8019834: InetAddress.getByName should always throw UHE for bad IPv6 literals

Chris Hegarty chris.hegarty at oracle.com
Fri Nov 8 03:32:54 PST 2013


This is an interesting little product bug that was originally thought to 
be a test stabilization issue, with 
java/net/ipv6tests/BadIPv6Addresses.java.

Depending on the input/configuration/patch level getaddrinfo may try to 
lookup a malformed IPv6 literal, and block for several seconds waiting 
for a reply. The test, BadIPv6Addresses.java, tries to lookup many bad 
addresses, and was appearing to hang in our test environments.

If a bad IPv6 literal is passed into getByName, then the implementation 
should catch this early. It should not ever try to lookup the given name 
in lookupAllHostAddr. There is already code in getAllByName(String, 
InetAddress) to do this, there is just a bug in the logic.

http://cr.openjdk.java.net/~chegar/8019834/webrev.00/

-Chris.



More information about the net-dev mailing list