ecore_evas: check evas_device's description value is null
authorJengHyun Kang <jhyuni.kang@samsung.com>
Thu, 19 Apr 2018 13:15:23 +0000 (22:15 +0900)
committerWonki Kim <wonki_.kim@samsung.com>
Fri, 20 Apr 2018 08:38:45 +0000 (17:38 +0900)
Change-Id: If6197c8c6dd1270c6db80a4fe3b32b37f35b96c1

src/modules/ecore_evas/engines/tbm/ecore_evas_tbm.c
src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c

index ad5f9cf..d269b91 100644 (file)
@@ -69,6 +69,7 @@ _ecore_evas_tbm_evas_device_find(Evas *evas, const char *identifier)
 {
    Eina_List *list, *l;
    Evas_Device *device;
+   char *evas_device_description;
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(evas, EINA_FALSE);
    EINA_SAFETY_ON_NULL_RETURN_VAL(identifier, EINA_FALSE);
@@ -76,7 +77,10 @@ _ecore_evas_tbm_evas_device_find(Evas *evas, const char *identifier)
    list = (Eina_List *)evas_device_list(evas, NULL);
    EINA_LIST_FOREACH(list, l, device)
      {
-        if (!strncmp(evas_device_description_get(device), identifier, strlen(identifier)))
+        evas_device_description = evas_device_description_get(device);
+        if (!evas_device_description) continue;
+
+        if (!strncmp(evas_device_description, identifier, strlen(identifier)))
           {
              return EINA_TRUE;
           }
@@ -137,6 +141,7 @@ _ecore_evas_tbm_cb_ecore_device_del(void *data, int type EINA_UNUSED, void *even
    Ecore_Evas *ee = (Ecore_Evas *)data;
    Eina_List *list, *l, *l_next;
    Evas_Device *device;
+   char *evas_device_description;
 
    ev = event;
 
@@ -145,7 +150,9 @@ _ecore_evas_tbm_cb_ecore_device_del(void *data, int type EINA_UNUSED, void *even
    list = (Eina_List *)evas_device_list(ee->evas, NULL);
    EINA_LIST_FOREACH_SAFE(list, l, l_next, device)
      {
-        if (!strncmp(evas_device_description_get(device), ev->identifier, strlen(ev->identifier)))
+        evas_device_description = evas_device_description_get(device);
+        if (!evas_device_description) continue;
+        if (!strncmp(evas_device_description, ev->identifier, strlen(ev->identifier)))
           {
              evas_device_del(device);
           }
index 570e865..bac165b 100644 (file)
@@ -1515,6 +1515,7 @@ _ecore_evas_wl_common_evas_device_find(Evas *evas, const char *identifier)
 {
    Eina_List *list, *l;
    Evas_Device *device;
+   char *evas_device_description;
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(evas, EINA_FALSE);
    EINA_SAFETY_ON_NULL_RETURN_VAL(identifier, EINA_FALSE);
@@ -1522,7 +1523,10 @@ _ecore_evas_wl_common_evas_device_find(Evas *evas, const char *identifier)
    list = (Eina_List *)evas_device_list(evas, NULL);
    EINA_LIST_FOREACH(list, l, device)
      {
-        if (!strncmp(evas_device_description_get(device), identifier, strlen(identifier)))
+        evas_device_description = evas_device_description_get(device);
+        if (!evas_device_description) continue;
+
+        if (!strncmp(evas_device_description, identifier, strlen(identifier)))
           {
              return EINA_TRUE;
           }
@@ -1535,14 +1539,18 @@ _ecore_evas_wl_common_default_seat_get(Evas *evas)
 {
    Eina_List *list, *l;
    Evas_Device *device;
+   char *evas_device_description;
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(evas, EINA_FALSE);
 
    list = (Eina_List *)evas_device_list(evas, NULL);
    EINA_LIST_FOREACH(list, l, device)
      {
+        evas_device_description = evas_device_description_get(device);
+        if (!evas_device_description) continue;
+
         if ((evas_device_class_get(device) == EVAS_DEVICE_CLASS_SEAT) &&
-            !strncmp(evas_device_description_get(device), "Wayland seat", sizeof("Wayland seat")))
+            !strncmp(evas_device_description, "Wayland seat", sizeof("Wayland seat")))
           {
              return device;
           }
@@ -1597,10 +1605,13 @@ _ecore_evas_wl_common_cb_tizen_device_del(void *data EINA_UNUSED, int type EINA_
    if (ev->window) win = ecore_wl2_window_find(ev->window);
    if (win) display = ecore_wl2_window_display_get(win);
 
+   if (!ev->identifier) return ECORE_CALLBACK_PASS_ON;
+
    EINA_LIST_FOREACH(ee_list, l, ee)
      {
         Ecore_Evas_Engine_Wl_Data *wdata;
         Evas_Device *device;
+        char *evas_device_description;
 
         wdata = ee->engine.data;
         if (display != wdata->display) continue;
@@ -1608,7 +1619,9 @@ _ecore_evas_wl_common_cb_tizen_device_del(void *data EINA_UNUSED, int type EINA_
         list = (Eina_List *)evas_device_list(ee->evas, NULL);
         EINA_LIST_FOREACH_SAFE(list, ll, ll_next, device)
           {
-             if (!strncmp(evas_device_description_get(device), ev->identifier, strlen(ev->identifier)))
+             evas_device_description = evas_device_description_get(device);
+             if (!evas_device_description) continue;
+             if (!strncmp(evas_device_description, ev->identifier, strlen(ev->identifier)))
                {
                   evas_device_del(device);
                }