Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,7 @@ public static void arraysEquals(
if (returnValue) return;
byte[] first = (byte[]) arguments[0];
byte[] second = (byte[]) arguments[1];
if (first == null || second == null) return;
TraceDataFlowNativeCallbacks.traceMemcmp(first, second, 1, hookId);
}

Expand Down Expand Up @@ -777,6 +778,7 @@ public static void arraysCompare(
if (returnValue == 0) return;
byte[] first = (byte[]) arguments[0];
byte[] second = (byte[]) arguments[1];
if (first == null || second == null) return;
TraceDataFlowNativeCallbacks.traceMemcmp(first, second, returnValue, hookId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,13 @@ public void cmpHookShouldHandleConcurrentModifications() throws InterruptedExcep
// noinspection ResultOfMethodCallIgnored
ES.awaitTermination(5, TimeUnit.SECONDS);
}

@Test
public void handlesNullValuesInArrayCompare() {
byte[] b1 = new byte[10];
byte[] b2 = null;
// Make sure we don't crash the JVM on null arrays.
TraceCmpHooks.arraysEquals(null, null, new Object[] {b1, b2}, 1, false);
TraceCmpHooks.arraysCompare(null, null, new Object[] {b1, b2}, 1, 1);
}
}