fix(JNI): resolve JNI code safety issues in native layer#17
Draft
Federico2014 wants to merge 5 commits intotronprotocol:masterfrom
Draft
fix(JNI): resolve JNI code safety issues in native layer#17Federico2014 wants to merge 5 commits intotronprotocol:masterfrom
Federico2014 wants to merge 5 commits intotronprotocol:masterfrom
Conversation
Author
|
This pr mainly fix the issue: #16. |
- update cpp/CMakeLists.txt to derive the Rust target from the active CMake architecture - build librustzcash with the matching Cargo target and link the correct target/<triple>/release archive - reject unsupported universal macOS builds to avoid mixed-architecture artifacts - re-sign the installed macOS JNI library after make install so Maven tests can load it without the forked JVM being killed - replace JDK-internal HexBin usage in LibsodiumTest and LibrustzcashTest with local hex decoders for JDK 17 compatibility - refresh README build instructions for Apple Silicon and clarify that Maven package/test commands should be run from the project root
… compatible - extract shared HexBin decoder into src/test/java/org/tron/common/zksnark/HexBin.java - remove duplicated HexBin inner classes from LibrustzcashTest and LibsodiumTest - replace COMMAND_ERROR_IS_FATAL in cpp/CMakeLists.txt with RESULT_VARIABLE checks so make install stays compatible with CMake 3.10.2 - refresh bundled macOS arm64 native library
feat(arm64_macos): stabilize Apple Silicon build and JDK 17 test flow
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.
Summary
This PR fixes critical JNI code safety issues in the native C++ layer.
Changes
LibrustzcashJNIImpl.cpp (25 functions fixed)
<iostream>with<cstring>JNI_ABORTon error pathsreinterpret_cast,static_cast,const_cast)NULLwithnullptrstrlenvsGetStringLength)LibsodiumJNIImpl.cpp (8 functions fixed)
<iostream>with<cstring>and<new>new (std::nothrow)to prevent unhandled exceptionsCMakeLists.txt
README.md
Testing