On Tue, 19 Oct 2021 06:45:58 GMT, Alan Bateman <al...@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