Skip to content

fix: harden JNI error handling - #410

Merged
devopvoid merged 2 commits into
mainfrom
fix/jni-error-handling
Oct 22, 2026
Merged

devopvoid merged 2 commits into
mainfrom
fix/jni-error-handling

Conversation

@devopvoid

Copy link
Copy Markdown
Owner
  • 86 JNI entry points that convert or allocate now catch C++ exceptions instead of letting them abort the VM.
  • Pinned byte arrays are null-checked and released through RAII in the audio and video buffer natives; AudioProcessing no longer leaks them on its early return.
  • AudioProcessing.processStream/processReverseStream return kBadDataLengthError for arrays shorter than the frame instead of reading and writing past them.

…llocates

86 entry points let a C++ exception, such as a JavaWrappedException from a conversion helper, cross the JNI boundary, which aborts the VM; they now rethrow it as a Java exception like the others.
…fer natives

Null results of GetByteArrayElements went unchecked, AudioProcessing leaked both arrays on its early return, and processStream read and wrote past arrays shorter than the configured frame; it now returns kBadDataLengthError for them.
@devopvoid
devopvoid merged commit b72f473 into main Oct 22, 2026
22 checks passed
@devopvoid
devopvoid deleted the fix/jni-error-handling branch October 22, 2026 06:27
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.

1 participant