signalapp / curve25519-java

Pure Java and JNI backed Curve25519 implementation.
GNU General Public License v3.0
233 stars 95 forks source link

Improve stability of primitive array lifecycle #30

Open MarcSchoenefeld opened 6 years ago

MarcSchoenefeld commented 6 years ago

https://github.com/signalapp/curve25519-java/blob/70fae57d6dccff7e78a46203c534314b07dfdd98/android/jni/curve25519-jni.c#L27

According to https://developer.android.com/training/articles/perf-jni , releasing an array requires a prior check to prevent releasing a Null pointer. There are multiple instances of this issue throughout the file.