Crash in string_i.h:121: pj_strncpy on android armeabi but not x86

AV
Anton VG
Wed, Mar 23, 2016 8:27 AM

Hi!
Trying to find out the reason the PJSUA2 sample app crashes here:

03-23 11:11:01.198 22964-22964/org.pjsip.pjsua2.app A/libc:
../include/pj/string_i.h:121: pj_strncpy: assertion "max >= 0" failed
03-23 11:11:01.198 22964-22964/org.pjsip.pjsua2.app A/libc: Fatal signal 6
(SIGABRT), code -6 in tid 22964 (jsip.pjsua2.app)

This is the case only while compiled for armeabi (v7a too), but x86
compilation works (on emulator).
arm lib crashes in emulator, and real devices

I have been trying ndk r10e, r9c and r8 - all got the same.

Thanks in advance
Anton

Hi! Trying to find out the reason the PJSUA2 sample app crashes here: 03-23 11:11:01.198 22964-22964/org.pjsip.pjsua2.app A/libc: ../include/pj/string_i.h:121: pj_strncpy: assertion "max >= 0" failed 03-23 11:11:01.198 22964-22964/org.pjsip.pjsua2.app A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 22964 (jsip.pjsua2.app) This is the case only while compiled for armeabi (v7a too), but x86 compilation works (on emulator). arm lib crashes in emulator, and real devices I have been trying ndk r10e, r9c and r8 - all got the same. Thanks in advance Anton
AV
Anton VG
Wed, Mar 23, 2016 9:27 AM

Yes, forgot to mention, that is true for PJSIP TRUNK. 2.4.5 release works.

2016-03-23 11:27 GMT+03:00 Anton VG anton.vazir@gmail.com:

Hi!
Trying to find out the reason the PJSUA2 sample app crashes here:

03-23 11:11:01.198 22964-22964/org.pjsip.pjsua2.app A/libc:
../include/pj/string_i.h:121: pj_strncpy: assertion "max >= 0" failed
03-23 11:11:01.198 22964-22964/org.pjsip.pjsua2.app A/libc: Fatal signal 6
(SIGABRT), code -6 in tid 22964 (jsip.pjsua2.app)

This is the case only while compiled for armeabi (v7a too), but x86
compilation works (on emulator).
arm lib crashes in emulator, and real devices

I have been trying ndk r10e, r9c and r8 - all got the same.

Thanks in advance
Anton

Yes, forgot to mention, that is true for PJSIP TRUNK. 2.4.5 release works. 2016-03-23 11:27 GMT+03:00 Anton VG <anton.vazir@gmail.com>: > Hi! > Trying to find out the reason the PJSUA2 sample app crashes here: > > 03-23 11:11:01.198 22964-22964/org.pjsip.pjsua2.app A/libc: > ../include/pj/string_i.h:121: pj_strncpy: assertion "max >= 0" failed > 03-23 11:11:01.198 22964-22964/org.pjsip.pjsua2.app A/libc: Fatal signal 6 > (SIGABRT), code -6 in tid 22964 (jsip.pjsua2.app) > > This is the case only while compiled for armeabi (v7a too), but x86 > compilation works (on emulator). > arm lib crashes in emulator, and real devices > > I have been trying ndk r10e, r9c and r8 - all got the same. > > Thanks in advance > Anton >
RF
Roberto Fichera
Thu, Mar 31, 2016 1:45 PM

On 03/23/2016 10:27 AM, Anton VG wrote:

Yes, forgot to mention, that is true for PJSIP TRUNK. 2.4.5 release works.

I'm also having the same issue.

2016-03-23 11:27 GMT+03:00 Anton VG <anton.vazir@gmail.com mailto:anton.vazir@gmail.com>:

 Hi!
 Trying to find out the reason the PJSUA2 sample app crashes here:

 03-23 11:11:01.198 22964-22964/org.pjsip.pjsua2.app A/libc: ../include/pj/string_i.h:121: pj_strncpy: assertion
 "max >= 0" failed
 03-23 11:11:01.198 22964-22964/org.pjsip.pjsua2.app A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 22964
 (jsip.pjsua2.app)

 This is the case only while compiled for armeabi (v7a too), but x86 compilation works (on emulator). 
 arm lib crashes in emulator, and real devices

 I have been trying ndk r10e, r9c and r8 - all got the same.

 Thanks in advance
 Anton

Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

On 03/23/2016 10:27 AM, Anton VG wrote: > Yes, forgot to mention, that is true for PJSIP TRUNK. 2.4.5 release works. I'm also having the same issue. > > 2016-03-23 11:27 GMT+03:00 Anton VG <anton.vazir@gmail.com <mailto:anton.vazir@gmail.com>>: > > Hi! > Trying to find out the reason the PJSUA2 sample app crashes here: > > 03-23 11:11:01.198 22964-22964/org.pjsip.pjsua2.app A/libc: ../include/pj/string_i.h:121: pj_strncpy: assertion > "max >= 0" failed > 03-23 11:11:01.198 22964-22964/org.pjsip.pjsua2.app A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 22964 > (jsip.pjsua2.app) > > This is the case only while compiled for armeabi (v7a too), but x86 compilation works (on emulator). > arm lib crashes in emulator, and real devices > > I have been trying ndk r10e, r9c and r8 - all got the same. > > Thanks in advance > Anton > > > > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
RF
Roberto Fichera
Thu, Mar 31, 2016 3:06 PM

On 03/31/2016 03:45 PM, Roberto Fichera wrote:

On 03/23/2016 10:27 AM, Anton VG wrote:

Yes, forgot to mention, that is true for PJSIP TRUNK. 2.4.5 release works.

I'm also having the same issue.

... and here is the fix. str->slen isn't initialized because comes from a local variable, only the ->ptr is initialized
correctly.

diff --git a/pjlib/src/pj/guid_android.c b/pjlib/src/pj/guid_android.c
index 02d473c..f68be20 100644
--- a/pjlib/src/pj/guid_android.c
+++ b/pjlib/src/pj/guid_android.c
@@ -103,7 +103,7 @@ PJ_DEF(pj_str_t*) pj_generate_unique_string(pj_str_t *str)

 native_str.ptr = (char *)native_string;
 native_str.slen = pj_ansi_strlen(native_string);
  • pj_strncpy(str, &native_str, str->slen);
  • pj_strncpy(str, &native_str, native_str.slen);

    (*jni_env)->ReleaseStringUTFChars(jni_env, uuid_string, native_string);
    detach_jvm(attached);

2016-03-23 11:27 GMT+03:00 Anton VG <anton.vazir@gmail.com mailto:anton.vazir@gmail.com>:

 Hi!
 Trying to find out the reason the PJSUA2 sample app crashes here:

 03-23 11:11:01.198 22964-22964/org.pjsip.pjsua2.app A/libc: ../include/pj/string_i.h:121: pj_strncpy: assertion
 "max >= 0" failed
 03-23 11:11:01.198 22964-22964/org.pjsip.pjsua2.app A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 22964
 (jsip.pjsua2.app)

 This is the case only while compiled for armeabi (v7a too), but x86 compilation works (on emulator). 
 arm lib crashes in emulator, and real devices

 I have been trying ndk r10e, r9c and r8 - all got the same.

 Thanks in advance
 Anton

Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

On 03/31/2016 03:45 PM, Roberto Fichera wrote: > On 03/23/2016 10:27 AM, Anton VG wrote: >> Yes, forgot to mention, that is true for PJSIP TRUNK. 2.4.5 release works. > > I'm also having the same issue. ... and here is the fix. str->slen isn't initialized because comes from a local variable, only the ->ptr is initialized correctly. diff --git a/pjlib/src/pj/guid_android.c b/pjlib/src/pj/guid_android.c index 02d473c..f68be20 100644 --- a/pjlib/src/pj/guid_android.c +++ b/pjlib/src/pj/guid_android.c @@ -103,7 +103,7 @@ PJ_DEF(pj_str_t*) pj_generate_unique_string(pj_str_t *str) native_str.ptr = (char *)native_string; native_str.slen = pj_ansi_strlen(native_string); - pj_strncpy(str, &native_str, str->slen); + pj_strncpy(str, &native_str, native_str.slen); (*jni_env)->ReleaseStringUTFChars(jni_env, uuid_string, native_string); detach_jvm(attached); > >> >> 2016-03-23 11:27 GMT+03:00 Anton VG <anton.vazir@gmail.com <mailto:anton.vazir@gmail.com>>: >> >> Hi! >> Trying to find out the reason the PJSUA2 sample app crashes here: >> >> 03-23 11:11:01.198 22964-22964/org.pjsip.pjsua2.app A/libc: ../include/pj/string_i.h:121: pj_strncpy: assertion >> "max >= 0" failed >> 03-23 11:11:01.198 22964-22964/org.pjsip.pjsua2.app A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 22964 >> (jsip.pjsua2.app) >> >> This is the case only while compiled for armeabi (v7a too), but x86 compilation works (on emulator). >> arm lib crashes in emulator, and real devices >> >> I have been trying ndk r10e, r9c and r8 - all got the same. >> >> Thanks in advance >> Anton >> >> >> >> >> _______________________________________________ >> Visit our blog: http://blog.pjsip.org >> >> pjsip mailing list >> pjsip@lists.pjsip.org >> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > > > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
RS
Riza Sulistyo
Fri, Apr 1, 2016 2:36 AM

Hi,

Just fixed this on r5272.
Thanks for the report!

Best Regards,

Riza

On Thu, Mar 31, 2016 at 10:06 PM, Roberto Fichera kernel@tekno-soft.it
wrote:

On 03/31/2016 03:45 PM, Roberto Fichera wrote:

On 03/23/2016 10:27 AM, Anton VG wrote:

Yes, forgot to mention, that is true for PJSIP TRUNK. 2.4.5 release works.

I'm also having the same issue.

... and here is the fix. str->slen isn't initialized because comes from a
local variable, only the ->ptr is initialized correctly.

diff --git a/pjlib/src/pj/guid_android.c b/pjlib/src/pj/guid_android.c
index 02d473c..f68be20 100644
--- a/pjlib/src/pj/guid_android.c
+++ b/pjlib/src/pj/guid_android.c
@@ -103,7 +103,7 @@ PJ_DEF(pj_str_t*) pj_generate_unique_string(pj_str_t
*str)

  native_str.ptr = (char *)native_string;
  native_str.slen = pj_ansi_strlen(native_string);
  • pj_strncpy(str, &native_str, str->slen);
  • pj_strncpy(str, &native_str, native_str.slen);

    (*jni_env)->ReleaseStringUTFChars(jni_env, uuid_string,
    native_string);
    detach_jvm(attached);

2016-03-23 11:27 GMT+03:00 Anton VG anton.vazir@gmail.com:

Hi!
Trying to find out the reason the PJSUA2 sample app crashes here:

03-23 11:11:01.198 22964-22964/org.pjsip.pjsua2.app A/libc:
../include/pj/string_i.h:121: pj_strncpy: assertion "max >= 0" failed
03-23 11:11:01.198 22964-22964/org.pjsip.pjsua2.app A/libc: Fatal signal
6 (SIGABRT), code -6 in tid 22964 (jsip.pjsua2.app)

This is the case only while compiled for armeabi (v7a too), but x86
compilation works (on emulator).
arm lib crashes in emulator, and real devices

I have been trying ndk r10e, r9c and r8 - all got the same.

Thanks in advance
Anton


Visit our blog: http://blog.pjsip.org

pjsip mailing listpjsip@lists.pjsip.orghttp://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org


Visit our blog: http://blog.pjsip.org

pjsip mailing listpjsip@lists.pjsip.orghttp://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org


Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

Hi, Just fixed this on r5272. Thanks for the report! Best Regards, Riza On Thu, Mar 31, 2016 at 10:06 PM, Roberto Fichera <kernel@tekno-soft.it> wrote: > On 03/31/2016 03:45 PM, Roberto Fichera wrote: > > On 03/23/2016 10:27 AM, Anton VG wrote: > > Yes, forgot to mention, that is true for PJSIP TRUNK. 2.4.5 release works. > > > I'm also having the same issue. > > > ... and here is the fix. str->slen isn't initialized because comes from a > local variable, only the ->ptr is initialized correctly. > > diff --git a/pjlib/src/pj/guid_android.c b/pjlib/src/pj/guid_android.c > index 02d473c..f68be20 100644 > --- a/pjlib/src/pj/guid_android.c > +++ b/pjlib/src/pj/guid_android.c > @@ -103,7 +103,7 @@ PJ_DEF(pj_str_t*) pj_generate_unique_string(pj_str_t > *str) > > native_str.ptr = (char *)native_string; > native_str.slen = pj_ansi_strlen(native_string); > - pj_strncpy(str, &native_str, str->slen); > + pj_strncpy(str, &native_str, native_str.slen); > > (*jni_env)->ReleaseStringUTFChars(jni_env, uuid_string, > native_string); > detach_jvm(attached); > > > > > 2016-03-23 11:27 GMT+03:00 Anton VG <anton.vazir@gmail.com>: > >> Hi! >> Trying to find out the reason the PJSUA2 sample app crashes here: >> >> 03-23 11:11:01.198 22964-22964/org.pjsip.pjsua2.app A/libc: >> ../include/pj/string_i.h:121: pj_strncpy: assertion "max >= 0" failed >> 03-23 11:11:01.198 22964-22964/org.pjsip.pjsua2.app A/libc: Fatal signal >> 6 (SIGABRT), code -6 in tid 22964 (jsip.pjsua2.app) >> >> This is the case only while compiled for armeabi (v7a too), but x86 >> compilation works (on emulator). >> arm lib crashes in emulator, and real devices >> >> I have been trying ndk r10e, r9c and r8 - all got the same. >> >> Thanks in advance >> Anton >> > > > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing listpjsip@lists.pjsip.orghttp://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > > > > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing listpjsip@lists.pjsip.orghttp://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > > > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > >