logo

Rust crates reviews

Cryptographically verifiable, distributed dependency reviews

crate: jni

https://lib.rs/crates/jni/

Add the last reviewed version to Cargo.toml / [dependencies]:

jni = "0.13.0"

Filter reviews clicking on the numbers in the summary.

Full column names in tooltip hints: rating Negative, rating Neutral, rating Positive, rating Strong, thoroughness, understanding, reviews count.

Neg
Neu
Pos
Str
tho
und
rev
1
1
crate version
rating
date
reviewer
thoroughness, understanding
jni 0.13.0
negative
2019-07-31
low, medium
issues:
high
Definite soundness issue

Rated files were at least reviewed to thoroughness + understanding medium, but the rest was only reviewed to througuhness low.

Detail

FileRatingNotes
.github/PULL_REQUEST_TEMPLATE.md+1
.travis/run_travis_job.sh+1
.vscode/tasks.json+1
benches/api_calls.rs+1Various API concerns but this file is fine.
examples/HelloWorld.h+1Matches HelloWorld.java... generated by javah?
examples/HelloWorld.java+1
examples/Makefile+1
src/wrapper/descriptors/class_desc.rs+1
src/wrapper/descriptors/desc.rs+1
src/wrapper/descriptors/exception_desc.rs+1
src/wrapper/descriptors/field_desc.rs+1
src/wrapper/descriptors/method_desc.rs+1
src/wrapper/descriptors/mod.rs+1
src/wrapper/java_vm/init_args.rs+1
src/wrapper/java_vm/mod.rs+1
src/wrapper/java_vm/vm.rs-1Not 100% sure if it's sound to detatch threads out from under other Java code. Some unsafe attach fns also confuse me as to why they're unsafe.
src/wrapper/objects/auto_local.rs-1Not 100% sure if AutoLocal::new is sound based on scary JVM crash warnings
src/wrapper/objects/global_ref.rs+1
src/wrapper/objects/jbytebuffer.rs-1Allowing construction from arbitrary jobject s will likely be unsound later
src/wrapper/objects/jclass.rs-1Ditto
src/wrapper/objects/jfieldid.rs-1Ditto
src/wrapper/objects/jlist.rs-1Called it - internal is used in safe fns, unsound looking as fuck.
src/wrapper/objects/jmap.rs
src/wrapper/objects/jmethodid.rs
src/wrapper/objects/jobject.rs
src/wrapper/objects/jstaticfieldid.rs
src/wrapper/objects/jstaticmethodid.rs
src/wrapper/objects/jstring.rs
src/wrapper/objects/jthrowable.rs
src/wrapper/objects/jvalue.rs
src/wrapper/objects/mod.rs
src/wrapper/strings/ffi_str.rs
src/wrapper/strings/java_str.rs
src/wrapper/strings/mod.rs
src/wrapper/errors.rs
src/wrapper/executor.rs
src/wrapper/jnienv.rs
src/wrapper/macros.rs
src/wrapper/signature.rs
src/wrapper/version.rs
src/lib.rs
src/sys.rs+1pub use jni_sys::*
tests/util/example_proxy.rs
tests/util/mod.rs
tests/executor_nested_attach.rs
tests/executor.rs
tests/java_integers.rs
tests/jmap.rs
tests/jni_api.rs
tests/jni_global_ref_is_deleted.rs
tests/jni_global_refs.rs
tests/threads_attach_guard.rs
tests/threads_detach_daemon.rs
tests/threads_detach.rs
tests/threads_explicit_detach_daemon.rs
tests/threads_explicit_detach_permanent.rs
tests/threads_explicit_detach.rs
tests/threads_nested_attach_daemon.rs
tests/threads_nested_attach_guard.rs
tests/threads_nested_attach_permanently.rs
.appveyor.yml
.gitignore
.travis.yml
Cargo.toml+1
Cargo.toml.orig+1
CHANGELOG.md+1
clippy.toml+1
CODE_OF_CONDUCT.md+1
CONTRIBUTING.md+1
LICENSE-APACHE+1
LICENSE-MIT+1
README.md+1
OtherRatingNotes
unsafe-1Unsound
fs+1Not used
io+1Not used
docs+1Well documented
tests+1Decent testing

benches/api_calls.rs

LineNotes
52..._unchecked is safe? Look at call_static_method_unchecked carefully.
69Not all ..._unchecked are safe?
154Must manually drop local refs? Lame.
226No use of black box?
+1

src/wrapper/descriptors/method_desc.rs

LineNotes
24I feel like having an implicit "<init>" instead of a struct of some sort is potentially confusing?
+1

src/wrapper/java_vm/init_args.rs

LineNotes
46Could use more doc-tests
50Silently ignoring unsupported options is a little lame
70JavaVM::build in doc comments, not new ?
101Pretty gosh darn heckin' sketchy if you ask me... relies on opts never being modified after this point. Fortunately this type's contents are nice and private/local, so that's enforced.
+1

src/wrapper/java_vm/vm.rs

LineNotes
134unsafe impl Send + Sync - I believe this is safe for JavaVM (as used here), but not for JNIEnv (keep a look out for that later)
150unsafe { ... } - ptr casts are a bit sketchy, otherwise LGTM.
158+1
165unsafe fn - +1
185attach_current_thread_permanently - possible noop if already attached, meaning it might be temporary!
232detach_current_thread - doc comments make this sound possibly unsound?
270unsafe { ... } - +1
280unsafe { ... } - +1
364unsafe fn - This... actually looks sound? What am I missing?
386unsafe fn - This... actually looks sound? What am I missing?
409unsafe { ... } - +1
-1 - Can detatched threads cause unsoundness? What am I missing for unsafe fn?

src/wrapper/objects/global_ref.rs

LineNotes
36unsafe impl Send + Sync - should be safe?
48unsafe fn - presumably because this takes a jobject. LGTM.
66unsafe fn - presumably because this takes a jobject. LGTM.
+1

src/wrapper/objects/jbytebuffer.rs

LineNotes
11jobject is just a pointer, so this general purpouse crate-exported method means using JByteBuffer s is unsafe!
32there's no guarantee a given JObject is a JByteBuffer, but this succeeds unconditionally.
-1 - I suspect invalid jobject s will cause soundness issues later

src/wrapper/objects/jlist.rs

LineNotes
20Eww, methods cached per-object?
46jobject -> JObject -> JList can be constructed with an invalid pointer...
69...making all safe fns on this type unsound. Use of 'safe' _unchecked methods also concerns me.
-1

src/wrapper/macros.rs

LineRatingNotes
...
26+1non_null
...
105+1java_vm_unchecked - 'unchecked' refers to error codes. unsafe macro, $java_vm must be valid.
132-1java_vm_method - I wish this forced the caller to use unsafe { ... }. unsafe macro, $jnienv must be valid.
...

TIL

  • Use javah to generate rust, perhaps?
  • [build-dependencies]

© bestia.dev 2023, MIT License, Version: 2023.608.1636

Open source repository for this web app: https://github.com/bestia-dev/cargo_crev_web/