RFR: 8275319 java.net.NetworkInterface throws java.lang.Error instead of SocketException [v3]
Daniel Jeliński
duke at openjdk.java.net
Tue Oct 19 07:26:57 UTC 2021
On Tue, 19 Oct 2021 06:45:58 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> Daniel Jeliński has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Fix crash on GetIpAddrTable error
>
> src/java.base/windows/native/libnet/NetworkInterface_winXP.c line 232:
>
>> 230: int getAllInterfacesAndAddresses (JNIEnv *env, netif **netifPP)
>> 231: {
>> 232: int ret, flags;
>
> This looks right but I can't relate this to your comment about the crash.
let me try to explain this clang-style:
- `tableP` contains [random garbage](https://github.com/openjdk/jdk/blob/a6c89e231872e7fab236ed87b5ccf44a189d6786/src/java.base/windows/native/libnet/NetworkInterface_winXP.c#L233)
- [lookupIPAddrTable](https://github.com/openjdk/jdk/blob/a6c89e231872e7fab236ed87b5ccf44a189d6786/src/java.base/windows/native/libnet/NetworkInterface_winXP.c#L266) returns error, does not touch `tableP`
- `ret` is unsigned, so [this is never true](https://github.com/openjdk/jdk/blob/a6c89e231872e7fab236ed87b5ccf44a189d6786/src/java.base/windows/native/libnet/NetworkInterface_winXP.c#L267)
- uninitialized `tableP` is passed to [enumAddresses_win_ipaddrtable](https://github.com/openjdk/jdk/blob/a6c89e231872e7fab236ed87b5ccf44a189d6786/src/java.base/windows/native/libnet/NetworkInterface_winXP.c#L272)
- `enumAddresses_win_ipaddrtable` [dereferences](https://github.com/openjdk/jdk/blob/a6c89e231872e7fab236ed87b5ccf44a189d6786/src/java.base/windows/native/libnet/NetworkInterface.c#L440) `tableP` and crashes
-------------
PR: https://git.openjdk.java.net/jdk/pull/5956
More information about the net-dev
mailing list