Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8205076

[17u] Inet6AddressImpl.c: `lookupIfLocalHost` accesses `int InetAddress.preferIPv6Address` as a boolean

XMLWordPrintable

    • b01
    • os_x

        In

            http://hg.openjdk.java.net/jdk/jdk/file/64ca9fbcf85f/src/java.base/unix/native/libnet/Inet6AddressImpl.c#l172
            if ((*env)->GetStaticBooleanField(env, ia_class, ia_preferIPv6AddressID)) {

        That is `InetAddress.preferIPv6Address` is used as a boolean, but

            http://hg.openjdk.java.net/jdk/jdk/file/64ca9fbcf85f/src/java.base/share/classes/java/net/InetAddress.java#l216
            /* Specify address family preference */
            static transient final int preferIPv6Address;

        That is, it is an `int`. (In JDK-8 it was a `boolean`.)

        I don't know how `GetStaticBoolean` deals with a mismatch in types. The result will be interpreted by the `C` 0-or-not-0 test. I don't know if that is what is needed here.

        (Note that this is inside a `#if defined(MACOSX)` block.)

              shade Aleksey Shipilev
              pbk Peter Kessler
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

                Created:
                Updated:
                Resolved: