This review is from Crev, a distributed system for code reviews. To add your review, set up cargo-crev.

The current version of cargo-apk is 0.8.2.

0.4.0 (older version) Rating: Negative Thoroughness: Low Understanding: Medium

by MaulingMonkey on 2019-07-24

A mixed bag. On the one hand, the core tool found in src seems fine, solid fundamentals. On the other hand, the glue code is full chock full of unsafe, some of it unsound. Worse, the FFI includes things that varies from android SDK to SDK from the loops of things.

injected-glue\ -1 Should be replaced with bindgen generated header? Also, changes between SDKs, so really really really should not be simply hardcoded...! Ref: Ref: 45 LOOPER_ID_INPUT: Wrong? (should be 2?: LOOPER_ID_EVENT? Different name? 46 LOOPER_ID_USER: Wrong? (should be 3?: 65+ Skimmed only

injected-glue\ -1 92 static mut ANDROID_APP should be UnsafeCell 164 static mut G_MAINTHREAD_BOXED should be UnsafeCell, probable undefined behavior / race conditions 172 scary transmutes 182 Unsound when combined with 191 'safe' access 196 android_main2 is UNSOUND - dereferencing pointers, setting globals, etc. without being marked unsafe. 197+ Skimmed only 340: giant unsafe block 347: uninitialized

src\ops\ +1 75 Medium: I suspect this won't work on windows as it doesn't use .cmd scripts for the compiler/linker? 131 Medium: injected_glue_lib cmd.exec()?; followed by cmd.exec_with_output()?; (134)- does the glue get double compiled for no good reason? 218 Medium: unreachable! abused where panic! probably should be? 423 Minor: Hardcodes a lot of assumptions. Good foundation though.

src\ops\ +1 Medium: No way to specify device src\ops\ +1 src\ops\ +1 Medium: No way to specify device

src\ +1 Minor: Could use more OsString Minor: Non-optional opengles_version_* src\ +1

Cargo.toml: +1 Cargo.toml.orig: +1 Sketchy looking casts and main handling... but might be right Strange parse_arguments loop style... but safe, looks sane.