Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## fix/jni-boundary-correctness #128 +/- ##
===============================================================
Coverage 72.21% 72.21%
Complexity 36 36
===============================================================
Files 62 62
Lines 2350 2350
Branches 286 286
===============================================================
Hits 1697 1697
Misses 493 493
Partials 160 160 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
redaranj
force-pushed
the
fix/utf8-string-bridging
branch
from
August 21, 2026 07:43
27c2200 to
c4b28a2
Compare
redaranj
force-pushed
the
fix/utf8-string-bridging
branch
from
September 8, 2026 07:02
c4b28a2 to
7dd37b7
Compare
redaranj
force-pushed
the
fix/utf8-string-bridging
branch
from
September 10, 2026 07:58
7dd37b7 to
24cb41a
Compare
scouten-adobe
force-pushed
the
fix/utf8-string-bridging
branch
from
September 10, 2026 17:47
24cb41a to
a5e2663
Compare
redaranj
force-pushed
the
fix/utf8-string-bridging
branch
from
September 18, 2026 09:57
a5e2663 to
fa4cee8
Compare
GetStringUTFChars and NewStringUTF operate in JNI modified UTF-8: supplementary-plane characters such as emoji become CESU-8 surrogate pairs the Rust FFI rejects on the way in, and NewStringUTF on a genuine 4-byte UTF-8 sequence from the core is undefined behavior that aborts under CheckJNI on the way out. The string helpers now transcode through UTF-16 (GetStringChars/NewString) with an explicit standard UTF-8 encoder and decoder in native code, mapping malformed input to U+FFFD in both directions. All call sites, the String array path, and every Kotlin signature are unchanged. Adds a shared test round-tripping a manifest title with supplementary-plane characters through sign and read.
The UTF-8 encoder wrote U+0000 as a literal zero byte, so a Kotlin string containing it reached the core as a NUL-terminated string cut short at that point. Before the standard-UTF-8 bridge, modified UTF-8 encoded it as C0 80, which the core rejected as invalid, so the input failed loudly instead of being truncated. Treat U+0000 as invalid input in jstring_to_cstring: free the buffer and throw IllegalArgumentException. Callers already handle the NULL return with an exception pending. Add a shared test that a remote URL containing U+0000 is rejected. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The strdup existed when jstring_to_cstring returned a JVM-pinned buffer that had to be released before the local ref. It now returns a malloc'd buffer and release_cstring_array frees each element, so store the conversion directly. This also removes a double throw: when the conversion failed, the OutOfMemoryError was raised on top of the exception the conversion had already left pending. Document why release_cstring keeps its unused env and jstr parameters. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
redaranj
force-pushed
the
fix/utf8-string-bridging
branch
from
September 28, 2026 07:51
fa4cee8 to
0b1bd3b
Compare
This branch has not been deployed
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.
Changes in this pull request
Replaces the modified-UTF-8 string bridging (GetStringUTFChars/NewStringUTF) with a UTF-16 transcode and explicit standard UTF-8 conversion in native code, so supplementary-plane characters like emoji survive the JNI boundary instead of being CESU-8-mangled inbound or hitting undefined behavior outbound. Confined entirely to the two string helpers — no call-site or Kotlin changes — with a round-trip test for a manifest title containing supplementary-plane characters.
Types of changes
Checklist
TO DOitems (or similar) have been entered as GitHub issues and the link to that issue has been included in a comment