-
Notifications
You must be signed in to change notification settings - Fork 27
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
v0.0.103.1 #56
Merged
Merged
v0.0.103.1 #56
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This resolves a NPE when calling trait methods if the user doesn't hold their own reference to the underlying trait, which is quite possible for, eg, the `Filter` object. We also adapt `HumanObjectPeerTest` to test this with a `Filter`.
TheBlueMatt
force-pushed
the
main
branch
5 times, most recently
from
December 1, 2021 06:59
91501f2
to
4ccc9c8
Compare
When users pass a static-length array to C we currently CHECK its length, asserting only if we are built in debug mode. In production, we happily call JNI's `GetByteArrayRegion` with the expected length, ignoring any errors. `GetByteArrayRegion`, however, "THROWS ArrayIndexOutOfBoundsException: if one of the indexes in the region is not valid.". While its somewhat unclear what "THROWS" means in the context of a C API, it seems safe to assume accessing return values after a "THROWS" condition is undefined. Thus, we should ensure we check array lengths before calling into C. We do this here with a simple wrapper function added to `org.ldk.util.InternalUtils` which checks an array is the correct length before returning it.
TheBlueMatt
force-pushed
the
main
branch
4 times, most recently
from
December 1, 2021 21:47
e779c9c
to
59ec115
Compare
TheBlueMatt
force-pushed
the
main
branch
4 times, most recently
from
December 2, 2021 19:28
1fb69fb
to
1f99c9c
Compare
When we return an object from a trait method called from Rust, we often return complex Java "Human" objects. Because the underlying object is owned by Java, we clone them before passing the objects back to Rust, if possible. However, the clone call happens after the Java method returns, at which point Java does not have any references to the original "Human" object, which upon free will free the underlying object. While the time between when the Java method returns and the C FFI code clones the object is incredibly short, CI did manage to find the race here in ASAN, where the original object may be freed before being accessed again for the clone in C. Here we fix this by simply cloneing the object being returned directly from Java.
As of this commit, leaks for a full run are down to: 17 allocations remained for 1115062 bytes.
TheBlueMatt
force-pushed
the
main
branch
2 times, most recently
from
December 2, 2021 20:32
ddf10d2
to
ccfa10a
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #55, #57, #59, #60, #62.