title: Crashing when using jni at libc.so in android
body: <p>After call the native method 'sign4Android' in .so, the app is crashed. The codes and logs are below. please help!</p>
  
  <p>Codes: </p>
  
  <pre><code>extern "C" JNIEXPORT jstring JNICALL Java_com_XXX_sign_SignHelper_getSign(JNIEnv *env, jobject obj, jstring input){
      const char *para = env-&gt;GetStringUTFChars(input, 0);
      std::string result_c = sign4Android(para);
      env-&gt;ReleaseStringUTFChars(input, para);
      const char *chars = result_c.c_str();
      jstring result = env-&gt;NewStringUTF(chars);
      delete chars;
      return result;
  } 
  </code></pre>
  
  <p>The native code method:</p>
  
  <pre><code>string sign4Android(const char* para);
  </code></pre>
  
  <p>Logs by using ndk-stack:</p>
  
  <pre><code>********** Crash dump: **********
  Build fingerprint: 'Xiaomi/virgo/virgo:6.0.1/MMB29M/6.3.31:user/release-keys'
  pid: 2610, tid: 2610,
  signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xca4007c8
  Stack frame #00 pc 00049228  /system/lib/libc.so (arena_run_reg_alloc+87): Routine arena_run_reg_alloc at arena.c:?
  Stack frame #01 pc 0004aff9  /system/lib/libc.so (je_arena_tcache_fill_small+104): Routine je_arena_tcache_fill_small at linux-atomic.c:?
  Stack frame #02 pc 0005c32b  /system/lib/libc.so (je_tcache_alloc_small_hard+18): Routine je_tcache_alloc_small_hard at linux-atomic.c:?
  Stack frame #03 pc 00056e1d  /system/lib/libc.so (je_malloc+1112): Routine je_malloc at linux-atomic.c:?
  Stack frame #04 pc 00021773  /system/lib/libhwui.so: Routine ????:0
  Stack frame #05 pc 0002e165  /system/lib/libhwui.so (android::uirenderer::DisplayListCanvas::drawRect(float, float, float, float, SkPaint const&amp;)+156): Routine ????:0
  Stack frame #06 pc 72ff926b  /data/dalvik-cache/arm/system@framework@boot.oat (offset 0x237a000)
  </code></pre>