On 3/4/20 4:41 PM, Marcel Hollerbach wrote:
Hi,

I was also looking at this piece the other day, but I was not having time to fix this. However, something that showed up to me:

- evas_object_intercept_init is only called in the macro EVAS_OBJECT_INTERCEPT_CALLBACK_DEFINE which is also getting the privat data, maybe we can just pass the obj pointer via params here, and safe the additional efl_data_scope_get call?

Makes sense to me.


- additionally, i think this should use efl_data_scope_safe_get, as its a forward facing API, which might get a object of the wrong type, which would crash right away right now.

Sure, that would work. I am heading out the door shortly, but I will take a look tomorrow and sort this out.


Cheers,

dh



Thank you,
   bu5hm4n

On 3/4/20 8:23 PM, Christopher Michael wrote:
devilhorns pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=7a89b7711f5dcd1c7f177634730b64cfbc9d1c06

commit 7a89b7711f5dcd1c7f177634730b64cfbc9d1c06
Author: Christopher Michael <[email protected]>
Date:   Wed Mar 4 14:20:47 2020 -0500

     evas: Fix dereferenceing null pointer
          Coverity reports a forward null here. If we do not get obj from      efl_data_scope_get then we should return. Also fixes some formatting
          Fixes CID1420216
---
  src/lib/evas/canvas/evas_object_intercept.c | 8 ++++++--
  1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/lib/evas/canvas/evas_object_intercept.c b/src/lib/evas/canvas/evas_object_intercept.c
index fd904f7708..c4a4b44f51 100644
--- a/src/lib/evas/canvas/evas_object_intercept.c
+++ b/src/lib/evas/canvas/evas_object_intercept.c
@@ -15,8 +15,12 @@ static void evas_object_intercept_deinit(Evas_Object *eo_obj);
  static void
  evas_object_intercept_init(Evas_Object *eo_obj)
  {
-   Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
-   if (!obj || !obj->interceptors)
+   Evas_Object_Protected_Data *obj;
+
+   obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
+   if (!obj) return;
+
+   if (!obj->interceptors)
       obj->interceptors = calloc(1, sizeof(Evas_Intercept_Func));
  }



_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to