Jni and native function:
Public native int authAccount (String account, String password, String check_new, String check_old, int err_code, int auth_result, Result the Result);
JNIEXPORT jint JNICALL
Env Java_com_example_sslvpn_1android_1sdk_GmSSL_authAccount (JNIEnv *, jobject thiz, jstring account,
Jstring password, jstring check_new,
Jstring check_old, jint err_code.
Jint auth_result, jobject result) {
//TODO: implement authAccount ()
Char * accountChar=(* env) - & gt; GetStringUTFChars (env, account, NULL);
Char * passwordChar=(* env) - & gt; GetStringUTFChars (env, password, NULL);
//char * checkNewChar=(* env) - & gt; GetStringUTFChars (env, check_new, NULL);
//char * checkOldChar=(* env) - & gt; GetStringUTFChars (env, check_old, NULL);
Jclass jclass1=(* env) - & gt; GetObjectClass (env, result);
If (jclass1==NULL) {
return -1;
}
JfieldID jfieldID=(* env) - & gt; GetFieldID (env, jclass1, "res", "Ljava/lang/String;" );
Jstring resValue=https://bbs.csdn.net/topics/(* env) -> GetObjectField (env, result, jfieldId);
Char * resultChar=(* env) - & gt; GetStringUTFChars (env, resValue, NULL);
Int res=sslvpn_auth_account (accountChar passwordChar, NULL, NULL, & amp; Err_code, & amp; Auth_result resultChar);
Jstring resultString=(* env) - & gt; NewStringUTF (env, resultChar);
(* env) - & gt; SetObjectField (env, result, jfieldId resultString);
(* env) - & gt; ReleaseStringUTFChars (env, account, accountChar);
(* env) - & gt; ReleaseStringUTFChars (env, password, passwordChar);
//(* env) - & gt; ReleaseStringUTFChars (env, check_new checkNewChar);
//(* env) - & gt; ReleaseStringUTFChars (env, check_old checkOldChar);
(* env) - & gt; ReleaseStringUTFChars (env, resValue resultChar);
//(* env) - & gt; DeleteLocalRef (env, resultString);
//(* env) - & gt; DeleteLocalRef (env, jclass1);
return res;
}
Error:
11 (SIGSEGV signal), 1 (SEGV_MAPERR) code, fault addr 0 x7465530a0d544d
X0 0000007605 0000000000000040 000000760616 b914 a27140 x1 x2 x3 0000000080407202
000000760616 ba80 x4 0000007605 a20848 x5 x6 0000007609 c50260 x7 ef0 0000007612766
By 8, 0000000000000000 2 x9 d7465530a0d544d x10 0000000000000001 x11 0000000000000000
X12 x13 x14 x15 0000000000000012 00000000000000 0000007606473098 0000007606473030 ff
X16 00000076960 fb260 x17 00000076960 f82b0 x18 00000075 a7b72000 x19 a27140 0000007605
0000007605 x20 000000760616 b914 x21 ab3ca8 x22 0000000000000000 x23 000000760616 c020
000000760616 x24 c020 000000760616 x25 bd50 x26 000000760616 c020 x27 000000760646 f020
X28 0000000000000000 x29 000000760616 b900
Sp 000000760616 b8f0 lr 00000076960 f81e0 PC 00000076960 f8334
Backtrace:
# 00 0000000000002334 PC/system/lib64/libbinderthreadstate so (_ZNSt3__15dequeIN7android18IPCThreadStateBase9CallStateENS_9allocatorIS3_EEE12emplace_backIJRS3_EEES8_DpOT_ + 132) (BuildId: cee8adb14565f37dd2bf1ff1af525e63)
# 01 PC 00000000000021 dc/system/lib64/libbinderthreadstate so (android: : IPCThreadStateBase: : pushCurrentState (android: : IPCThreadStateBase: : CallState) + 36) (BuildId: cee8adb14565f37dd2bf1ff1af525e63)
# 02 PC 00000000000641 d4/system/lib64/libbinder so (android: : IPCThreadState: : executeCommand (int) + 820) (9 cdc521320b9aad87123c58011fc602e BuildId:)
# 0000000000063 dec 03 PC/system/lib64/libbinder so (android: : IPCThreadState: : getAndExecuteCommand () + 156) (9 cdc521320b9aad87123c58011fc602e BuildId:)
# 4 PC/0000000000064674 system/lib64/libbinder so (android: : IPCThreadState: : joinThreadPool (bool) + 60) (9 cdc521320b9aad87123c58011fc602e BuildId:)
# 5 PCS 000000000008 a910/system/lib64/libbinder so (android: : PoolThread: : threadLoop () + 24) (9 cdc521320b9aad87123c58011fc602e BuildId:)
# 6 PC 00000000000136 d8/system/lib64/libutils so (android: : Thread: : _threadLoop (void *) + 288) (BuildId: b033168dfe889b3bc8dd188a3d69a675)
# 7 PC 00000000000 e9fd4/system/lib64/libandroid_runtime so (android: : AndroidRuntime: : javaThreadShell (void *) + 140) (BuildId: 6 eda35f292c7c747d85e4432cb3e561b)
# 8 PC 00000000000 ce1b0/apex/com. Android. The runtime/lib64/bionic/libc. So (__pthread_start (void *) + 36) (212095 a5bb472f1fd33898cf4066bc50 BuildId:)
# 09 PC 0000000000070 ba8/apex/com. Android. The runtime/lib64/bionic/libc. So (__start_thread + 64) (212095 a5bb472f1fd33898cf4066bc50 BuildId:)
CodePudding user response:
IPCThreadStateBase CallState allocatorIHas happened here on memory, and see if it is something wrong with memory allocation