Fix static analysis result

[Dereference after null check]

(1) src/lib/ecore/ecore_main.c
 - _efl_loop_handler_efl_object_finalize checks if pd->loop_data is NULL.
   After that, _handler_reset > _handler_clear > _ecore_main_fd_handler_del >
   _ecore_main_fdh_pool_del is directly dereferencing pd->pool_data.
 - _efl_loop_handler_efl_object_parent_set checks if pd->loop_data as well.
   Then it calls _handler_reset as well.

(2) src/lib/ecore_wayland/ecore_wl_dnd.c
  - ecore_wl_dnd_selection_set checks if t - result of wl_array_add - is NULL.
    And it is dereferecing t directly for wl_data_source_offer.

(3) src/lib/elementary/efl_ui_dnd.c
 - Third parameter const char *data could be NULL.
   In this case strlen dereferences NULL. The data should be non NULL value.
   I have checked this with Mr. Thiep Ha.

(4) src/lib/evas/canvas/evas_object_inform.c
 - _efl_canvas_object_efl_gfx_stack_stack_below checks if obj->layer is NULL.
   So it could call evas_object_inform_call_call_restack which is dereferencing
   obj->layer directly.
This commit is contained in:
Shinwoo Kim 2018-04-05 13:18:03 +09:00 committed by Shinwoo Kim
parent 2105bc4fb1
commit 3cd2243028
4 changed files with 14 additions and 3 deletions

View File

@ -425,6 +425,12 @@ _ecore_main_fdh_poll_del(Efl_Loop_Data *pd, Ecore_Fd_Handler *fdh)
if (!_dl_uv_run)
# endif
{
if (!pd)
{
WRN("Efl_Loop_Data is NULL!");
return;
}
if ((!fdh->file) && (pd->epoll_fd >= 0))
{
struct epoll_event ev;

View File

@ -170,8 +170,11 @@ ecore_wl_dnd_selection_set(Ecore_Wl_Input *input, const char **types_offered)
for (type = types_offered; *type; type++)
{
t = wl_array_add(&input->data_types, sizeof(*t));
if (t) *t = strdup(*type);
wl_data_source_offer(input->data_source, *t);
if (t)
{
*t = strdup(*type);
wl_data_source_offer(input->data_source, *t);
}
}
/* add a listener for data source events */

View File

@ -307,6 +307,7 @@ elm_drag_start(Evas_Object *obj, Elm_Sel_Format format, const char *data,
Elm_Drag_Accept drag_accept_cb, void *drag_accept_data,
Elm_Drag_State drag_done_cb, void *drag_done_data)
{
if (!data) return EINA_FALSE;
Eo *sel_man = _selection_manager_get(obj);
int seatid = 1;
Eina_Slice sl;

View File

@ -46,7 +46,8 @@ evas_object_inform_call_restack(Evas_Object *eo_obj, Evas_Object_Protected_Data
int event_id = _evas_object_event_new();
evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_RESTACK, NULL, event_id, EFL_GFX_EVENT_RESTACK);
_evas_post_event_callback_call(obj->layer->evas->evas, obj->layer->evas, event_id);
if (obj->layer)
_evas_post_event_callback_call(obj->layer->evas->evas, obj->layer->evas, event_id);
}
void