From ad97989b28dff5744fdbe66943fa20789a5c2d2a Mon Sep 17 00:00:00 2001 From: Shinwoo Kim Date: Tue, 4 Sep 2018 11:54:17 +0100 Subject: [PATCH] ecore_event: initialize uninitialized variable Summary: The following commit (1) made an abort (2) (1) commit d1e4c6bab84e55837a70b8883a28e7eb6d49db09 Author: Jean Guyomarc'h 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 3f306491a32a1880bccfe64861b5fec2ba09049b Author: Yeongjong Lee 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 --- src/lib/ecore/ecore_event_message_handler.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/ecore/ecore_event_message_handler.c b/src/lib/ecore/ecore_event_message_handler.c index 6df1227cf0..60ab2c9395 100644 --- a/src/lib/ecore/ecore_event_message_handler.c +++ b/src/lib/ecore/ecore_event_message_handler.c @@ -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;