ecore_event: initialize uninitialized variable

Summary:
The following commit (1) made an abort (2)

(1) commit d1e4c6bab8
Author: Jean Guyomarc'h <jean@guyomarch.bzh>
Date:   Mon Aug 27 12:04:35 2018 +0900

    ecore: fix built-in event types generation

(2) abort
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)
/lib/x86_64-linux-gnu/libc.so.6(+0x8037a)
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)
/home/kimcinoo/install/lib/libecore.so.1(+0x237d7)
/home/kimcinoo/install/lib/libeo.so.1(efl_destructor+0x64)
/home/kimcinoo/install/lib/libeo.so.1(+0x18029)
/home/kimcinoo/install/lib/libeo.so.1(efl_unref+0x44c)
/home/kimcinoo/install/lib/libecore.so.1(+0x201f2)
/home/kimcinoo/install/lib/libecore.so.1(ecore_shutdown+0x145)
/home/kimcinoo/Upstream/efl/src/tests/ecore/.libs/lt-efl_app_suite(+0xb85d)
/home/kimcinoo/install/lib/libcheck.so.0(srunner_run_tagged+0xa13)
/home/kimcinoo/Upstream/efl/src/tests/ecore/.libs/lt-efl_app_suite(+0xead9)
/home/kimcinoo/Upstream/efl/src/tests/ecore/.libs/lt-efl_app_suite(+0x4ade)
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)
/home/kimcinoo/Upstream/efl/src/tests/ecore/.libs/lt-efl_app_suite

And following commit (3) fixed the abort.

(3) commit 3f306491a3
Author: Yeongjong Lee <cleanlyj@naver.com>
Date:   Mon Sep 3 15:55:13 2018 +0000

    ecore_event: fix ecore event handler iterator range

The above commit fixed the abort though, we could access uninitialized memory
and make another abort again. This would prevent such unwanted case.

Reviewers: Hermet, YOhoho, bu5hm4n, netstar

Reviewed By: netstar

Subscribers: netstar, cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6970
This commit is contained in:
Shinwoo Kim 2018-09-04 11:54:17 +01:00 committed by Alastair Poole
parent fd87dbce38
commit ad97989b28
1 changed files with 1 additions and 0 deletions

View File

@ -134,6 +134,7 @@ _ecore_event_message_handler_type_new(Eo *obj EINA_UNUSED, Ecore_Event_Message_H
tmp = realloc(pd->handlers, sizeof(Eina_Inlist *) * (evnum + 1));
if (!tmp) return 0;
pd->handlers = tmp;
pd->handlers[ECORE_EVENT_NONE] = NULL;
pd->handlers[evnum] = NULL;
pd->event_type_count = evnum;
return evnum;