{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/conceal/issues/72","labels_url":"https://api.github.com/repos/facebook/conceal/issues/72/labels{/name}","comments_url":"https://api.github.com/repos/facebook/conceal/issues/72/comments","events_url":"https://api.github.com/repos/facebook/conceal/issues/72/events","html_url":"https://github.com/facebook/conceal/issues/72","id":81072087,"number":72,"title":"Crash on SDK 22, jarray was NULL","user":{"login":"deftelf","id":233220,"avatar_url":"https://avatars.githubusercontent.com/u/233220?v=3","gravatar_id":"","url":"https://api.github.com/users/deftelf","html_url":"https://github.com/deftelf","followers_url":"https://api.github.com/users/deftelf/followers","following_url":"https://api.github.com/users/deftelf/following{/other_user}","gists_url":"https://api.github.com/users/deftelf/gists{/gist_id}","starred_url":"https://api.github.com/users/deftelf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deftelf/subscriptions","organizations_url":"https://api.github.com/users/deftelf/orgs","repos_url":"https://api.github.com/users/deftelf/repos","events_url":"https://api.github.com/users/deftelf/events{/privacy}","received_events_url":"https://api.github.com/users/deftelf/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-05-26T18:04:06Z","updated_at":"2015-05-27T10:40:39Z","closed_at":"2015-05-27T10:40:39Z","body":"Hi, I'm getting a crash on the first call to getCypherOutputStream on Android 5.1 only. It's happening in the emulator, and a virtually identical emulator for 5.0 doesn't crash. Weirdly it doesn't seem to happen when I reload the app and call again, then it works fine. The first load of the app will be creating the keys before instantiating Crypto object while the second just loads them from the keystore, but I can't see an obvious reason why this would be different, and work OK on older Android releases.\r\n\r\nDo you need more? I will continue to investigate.\r\n\r\n```\r\n05-26 17:55:51.850    2658-3875/com.msty A/art﹕ art/runtime/check_jni.cc:65] JNI DETECTED ERROR IN APPLICATION: jarray was NULL\r\n05-26 17:55:51.850    2658-3875/com.msty A/art﹕ art/runtime/check_jni.cc:65]     in call to GetByteArrayElements\r\n05-26 17:55:51.850    2658-3875/com.msty A/art﹕ art/runtime/check_jni.cc:65]     from int com.facebook.crypto.cipher.NativeGCMCipher.nativeEncryptInit(byte[], byte[])\r\n05-26 17:55:51.850    2658-3875/com.msty A/art﹕ art/runtime/check_jni.cc:65] \"Loader:ExtractorSampleSource\" prio=5 tid=138 Runnable\r\n05-26 17:55:51.850    2658-3875/com.msty A/art﹕ art/runtime/check_jni.cc:65]   | group=\"main\" sCount=0 dsCount=0 obj=0x131cb2e0 self=0xda0ee400\r\n05-26 17:55:51.850    2658-3875/com.msty A/art﹕ art/runtime/check_jni.cc:65]   | sysTid=3875 nice=0 cgrp=default sched=0/0 handle=0xda365f00\r\n05-26 17:55:51.850    2658-3875/com.msty A/art﹕ art/runtime/check_jni.cc:65]   | state=R schedstat=( 0 0 0 ) utm=3 stm=0 core=0 HZ=100\r\n05-26 17:55:51.850    2658-3875/com.msty A/art﹕ art/runtime/check_jni.cc:65]   | stack=0xd35cf000-0xd35d1000 stackSize=1036KB\r\n05-26 17:55:51.850    2658-3875/com.msty A/art﹕ art/runtime/check_jni.cc:65]   | held mutexes= \"mutator lock\"(shared held)\r\n05-26 17:55:51.850    2658-3875/com.msty A/art﹕ art/runtime/check_jni.cc:65]   native: #00 pc 00005d03  /system/lib/libbacktrace_libc++.so (UnwindCurrent::Unwind(unsigned int, ucontext*)+83)\r\n05-26 17:55:51.850    2658-3875/com.msty A/art﹕ art/runtime/check_jni.cc:65]   native: #01 pc 00003051  /system/lib/libbacktrace_libc++.so (Backtrace::Unwind(unsigned int, ucontext*)+33)\r\n05-26 17:55:51.850    2658-3875/com.msty A/art﹕ art/runtime/check_jni.cc:65]   native: #02 pc 003c9e67  /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, char const*, art::mirror::ArtMethod*)+135)\r\n05-26 17:55:51.850    2658-3875/com.msty A/art﹕ art/runtime/check_jni.cc:65]   native: #03 pc 00393222  /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const+306)\r\n05-26 17:55:51.850    2658-3875/com.msty A/art﹕ art/runtime/check_jni.cc:65]   native: #04 pc 001029bb  /system/lib/libart.so (art::JniAbort(char const*, char const*)+1019)\r\n05-26 17:55:51.850    2658-3875/com.msty A/art﹕ art/runtime/check_jni.cc:65]   native: #05 pc 0010359c  /system/lib/libart.so (art::JniAbortF(char const*, char const*, ...)+108)\r\n05-26 17:55:51.850    2658-3875/com.msty A/art﹕ art/runtime/check_jni.cc:65]   native: #06 pc 00108117  /system/lib/libart.so (art::ScopedCheck::Check(bool, char const*, ...) (.constprop.131)+2743)\r\n05-26 17:55:51.850    2658-3875/com.msty A/art﹕ art/runtime/check_jni.cc:65]   native: #07 pc 0010cf55  /system/lib/libart.so (art::CheckJNI::GetByteArrayElements(_JNIEnv*, _jbyteArray*, unsigned char*)+101)\r\n05-26 17:55:51.850    2658-3875/com.msty A/art﹕ art/runtime/check_jni.cc:65]   native: #08 pc 00008f8b  /data/app/com.msty-1/lib/x86/libconceal.so (???)\r\n05-26 17:55:51.850    2658-3875/com.msty A/art﹕ art/runtime/check_jni.cc:65]   native: #09 pc 00008a2c  /data/app/com.msty-1/lib/x86/libconceal.so (Java_com_facebook_crypto_cipher_NativeGCMCipher_nativeEncryptInit+65)\r\n05-26 17:55:51.850    2658-3875/com.msty A/art﹕ art/runtime/check_jni.cc:65]   native: #10 pc 00155c8f  /data/dalvik-cache/x86/data@app@com.msty-1@base.apk@classes.dex (Java_com_facebook_crypto_cipher_NativeGCMCipher_nativeEncryptInit___3B_3B+179)\r\n05-26 17:55:51.850    2658-3875/com.msty A/art﹕ art/runtime/check_jni.cc:65]   at com.facebook.crypto.cipher.NativeGCMCipher.nativeEncryptInit(Native method)\r\n05-26 17:55:51.850    2658-3875/com.msty A/art﹕ art/runtime/check_jni.cc:65]   at com.facebook.crypto.cipher.NativeGCMCipher.encryptInit(NativeGCMCipher.java:55)\r\n05-26 17:55:51.850    2658-3875/com.msty A/art﹕ art/runtime/check_jni.cc:65]   at com.facebook.crypto.CipherHelper.getCipherOutputStream(CipherHelper.java:38)\r\n05-26 17:55:51.850    2658-3875/com.msty A/art﹕ art/runtime/check_jni.cc:65]   at com.facebook.crypto.Crypto.encrypt(Crypto.java:102)\r\n```"},"comment":{"url":"https://api.github.com/repos/facebook/conceal/issues/comments/105861975","html_url":"https://github.com/facebook/conceal/issues/72#issuecomment-105861975","issue_url":"https://api.github.com/repos/facebook/conceal/issues/72","id":105861975,"user":{"login":"deftelf","id":233220,"avatar_url":"https://avatars.githubusercontent.com/u/233220?v=3","gravatar_id":"","url":"https://api.github.com/users/deftelf","html_url":"https://github.com/deftelf","followers_url":"https://api.github.com/users/deftelf/followers","following_url":"https://api.github.com/users/deftelf/following{/other_user}","gists_url":"https://api.github.com/users/deftelf/gists{/gist_id}","starred_url":"https://api.github.com/users/deftelf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deftelf/subscriptions","organizations_url":"https://api.github.com/users/deftelf/orgs","repos_url":"https://api.github.com/users/deftelf/repos","events_url":"https://api.github.com/users/deftelf/events{/privacy}","received_events_url":"https://api.github.com/users/deftelf/received_events","type":"User","site_admin":false},"created_at":"2015-05-27T10:40:39Z","updated_at":"2015-05-27T10:40:39Z","body":"Argh, never mind, was my code error. I was clearing the cypher keys on logout and not creating new ones, so my Crypto object was pointed at null keys."}}