Skip to content

Conversation

@simonresch
Copy link
Contributor

null arrays would crash in the Arrays.equal and Arrays.compare hooks.

`null` arrays would crash in the `Arrays.equal` and `Arrays.compare`
hooks.
@simonresch simonresch force-pushed the fix-segfault-on-null-array branch from 97c492d to c1609a3 Compare November 20, 2025 14:47
@simonresch simonresch marked this pull request as ready for review November 20, 2025 14:47
@simonresch simonresch requested a review from a team November 20, 2025 14:48
if (returnValue) return;
byte[] first = (byte[]) arguments[0];
byte[] second = (byte[]) arguments[1];
if (first == null || second == null) return;
Copy link
Contributor

@oetr oetr Nov 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a minute I was thinking that maybe this might be worth a try:

TraceDataFlowNativeCallbacks.traceMemcmp(first != null ? first : new byte[0] , second != null ? second : new byte[0], 1, hookId);

But then I remembered, that randomly inserting strings (without knowing where to insert, because one arg has no data) is almost worthless, so it's best to just exit, like you do.

Copy link
Contributor

@oetr oetr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants