Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d4b9486c authored by yongchun.x.lu's avatar yongchun.x.lu Committed by tiger meng
Browse files

Native crash SIGSEGV bad ptr from /system/lib/libdvm.so

This issue is caused by null pointer exception. Add safe
protection before get the byte array value. If
the value is null, return without doing anything.

Change-Id: Ib2541e111033ee9725878e88c7dbac8360027d8e
parent fe0ec4b6
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -954,6 +954,11 @@ static void gattClientWriteCharacteristicNative(JNIEnv* env, jobject object,
{
{
    if (!sGattIf) return;
    if (!sGattIf) return;


    if (value == NULL) {
        warn("gattClientWriteCharacteristicNative() ignoring NULL array");
        return;
    }

    btgatt_srvc_id_t srvc_id;
    btgatt_srvc_id_t srvc_id;
    srvc_id.id.inst_id = (uint8_t) service_id_inst_id;
    srvc_id.id.inst_id = (uint8_t) service_id_inst_id;
    srvc_id.is_primary = (service_type == BTGATT_SERVICE_TYPE_PRIMARY ? 1 : 0);
    srvc_id.is_primary = (service_type == BTGATT_SERVICE_TYPE_PRIMARY ? 1 : 0);