Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix nullptr dereference when not calling JNI_OnLoad on Android #3984

Merged
merged 3 commits into from
Aug 16, 2024

Conversation

henriqueaklein
Copy link
Contributor

This change is applicable to loading the wallet-core on Android using the library directly instead of JNI.
Without calling JNI_OnLoad the jvm pointer is NULL, so any attempt to use it in random_buffer will result in a nullptr dereference.

In addition to preventing the crash, the Unix compatible implementation was used as an alternative when using the library directly.

Copy link
Collaborator

@satoshiotomakan satoshiotomakan left a comment

Choose a reason for hiding this comment

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

Hi @henriqueaklein, thank you for opening the PR! Please consider making a little change

jni/cpp/Random.cpp Outdated Show resolved Hide resolved
@satoshiotomakan satoshiotomakan merged commit d65c344 into trustwallet:master Aug 16, 2024
12 checks passed
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.

2 participants