Repository navigation
bindings: JNI & React-Native FFI memory-safety - #708
Merged
Merged
Conversation
ncylich
added a commit
that referenced
this pull request
Jun 10, 2026
…ot for direct merge) Signed-off-by: Noah Cylich <noahcylich@gmail.com>
kar-m
reviewed
Jun 10, 2026
Collaborator
|
even with the issue in comment i think this lgtm @jakmro |
ncylich
added a commit
that referenced
this pull request
Jun 10, 2026
In nativeIndexAdd, IndexAddBuffers and QueryResults, EnsureLocalCapacity's return value was ignored; on failure it leaves a pending OutOfMemoryError, so the subsequent JNI calls would run with a pending exception. Gate element acquisition on a successful EnsureLocalCapacity instead — on failure the loop is skipped and the existing acquired<count path clears the exception and returns -1. Addresses review feedback on #708. Signed-off-by: Noah Cylich <noahcylich@gmail.com>
ncylich
added a commit
that referenced
this pull request
Jun 10, 2026
…ot for direct merge) Signed-off-by: Noah Cylich <noahcylich@gmail.com>
cactus_jni.cpp: clear pending Java exceptions after token/log callback dispatch so the next native->Java transition doesn't run with one pending; on batched index_add/query, handle null array elements by releasing the partially-acquired refs (tracked via 'acquired') and bailing instead of dereferencing null. Cactus.swift: validate equal ids/documents/embeddings/metadatas lengths and uniform embedding-row widths before calling native index_add to prevent out-of-bounds reads. Signed-off-by: Noah Cylich <noahcylich@gmail.com>
ncylich
force-pushed
the
audit/bindings-ffi-safety
branch
from
June 10, 2026 02:51
8a0f33f to
6100a55
Compare
ncylich
added a commit
that referenced
this pull request
Jun 10, 2026
…ot for direct merge) Signed-off-by: Noah Cylich <noahcylich@gmail.com>
ncylich
added a commit
that referenced
this pull request
Jun 10, 2026
…ot for direct merge) Signed-off-by: Noah Cylich <noahcylich@gmail.com>
ncylich
added a commit
that referenced
this pull request
Jun 10, 2026
…ot for direct merge) Signed-off-by: Noah Cylich <noahcylich@gmail.com>
ncylich
added a commit
that referenced
this pull request
Jun 10, 2026
…ot for direct merge) Signed-off-by: Noah Cylich <noahcylich@gmail.com>
ncylich
added a commit
that referenced
this pull request
Jun 10, 2026
…ot for direct merge) Signed-off-by: Noah Cylich <noahcylich@gmail.com>
ncylich
added a commit
that referenced
this pull request
Jun 10, 2026
…ot for direct merge) Signed-off-by: Noah Cylich <noahcylich@gmail.com>
ncylich
marked this pull request as ready for review
June 10, 2026 06:05
This file contains hidden or 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
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.
cactus_jni.cpp: clear pending Java exceptions after callback dispatch, reserve local-ref capacity for batched index_add, and clean up partially-acquired refs on null array elements. Cactus.swift: validate equal lengths and uniform embedding-row widths before calling native index_add to prevent out-of-bounds reads.
Signed-off-by: Noah Cylich noahcylich@gmail.com