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

Correctly use jlong and jint in native function definition to fix pos… #311

Merged
merged 1 commit into from Jul 28, 2021

Conversation

normanmaurer
Copy link
Member

…sible segfault

Motivation:

Due a bug we used long and int in the function definition while it must be jlong and jint. The problem is that jlong may not be the same "size" as long and so using the wrong type may result in truncating of the value. In this case we would use the wrong value as pointer and then crash.

While the crashes were only observed on the CI on windows the reality is that it can happen basically everywhere. Long story short: the 'j' matters ...

Modifications:

Use jlong and jint

Result:

Fixes native crashes

…sible segfault

Motivation:

Due a bug we used long and int in the function definition while it must be jlong and jint. The problem is that jlong may not be the same "size" as long and so using the wrong type may result in truncating of the value. In this case we would use the wrong value as pointer and then crash.

While the crashes were only observed on the CI on windows the reality is that it can happen basically everywhere. Long story short: the 'j' matters ...

Modifications:

Use jlong and jint

Result:

Fixes native crashes
@normanmaurer
Copy link
Member Author

Let me just hide in the woods for the rest of my life ... 🤦

@normanmaurer normanmaurer added this to the 0.0.17.Final milestone Jul 28, 2021
@normanmaurer normanmaurer merged commit d02ae25 into main Jul 28, 2021
@normanmaurer normanmaurer deleted the native_crash_fix branch July 28, 2021 11:43
@NiteshKant
Copy link
Member

Let me just hide in the woods

Just make sure it is JWoods though

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.

None yet

3 participants