diff options
author | Tobias Brunner <tobias@strongswan.org> | 2012-09-24 16:56:37 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2012-09-24 17:16:29 +0200 |
commit | 94106ddc85f381d4b29d99947af0bd365cb72eb3 (patch) | |
tree | a63a3035d156280f8f4e5d6462febf495cf1e56d /src | |
parent | dfefa2f6dc303cd967a9b5544df874b69d8b6184 (diff) | |
download | strongswan-94106ddc85f381d4b29d99947af0bd365cb72eb3.tar.bz2 strongswan-94106ddc85f381d4b29d99947af0bd365cb72eb3.tar.xz |
android: Leak the private key reference on Jelly Bean to avoid a bug in the framework
A bug in the framework on Android Jelly Bean causes a SIGSEGV when the private
key object returned from KeyChain.getPrivateKey is garbage collected.
Leaking the global reference to that object prevents the garbage
collection and thereby the crash.
Diffstat (limited to 'src')
-rw-r--r-- | src/frontends/android/jni/libandroidbridge/backend/android_private_key.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/frontends/android/jni/libandroidbridge/backend/android_private_key.c b/src/frontends/android/jni/libandroidbridge/backend/android_private_key.c index e8a78b5da..3ed3d75a9 100644 --- a/src/frontends/android/jni/libandroidbridge/backend/android_private_key.c +++ b/src/frontends/android/jni/libandroidbridge/backend/android_private_key.c @@ -232,7 +232,16 @@ METHOD(private_key_t, destroy, void, JNIEnv *env; androidjni_attach_thread(&env); - (*env)->DeleteGlobalRef(env, this->key); + if (android_sdk_version >= ANDROID_JELLY_BEAN) + { /* there is a bug in JB that causes a SIGSEGV if the key object is + * garbage collected so we intentionally leak the reference to it */ + DBG1(DBG_LIB, "intentionally leaking private key reference due to " + "a bug in the framework"); + } + else + { + (*env)->DeleteGlobalRef(env, this->key); + } (*env)->DeleteGlobalRef(env, this->signature_class); androidjni_detach_thread(); this->pubkey->destroy(this->pubkey); |