evas legacy event mask - cast to unit64_t before bitshift
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Fri, 28 Jul 2017 11:08:21 +0000 (20:08 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Sat, 29 Jul 2017 00:08:31 +0000 (09:08 +0900)
this fixes a bit wraparound in the shift as the 1 is an int (32bit)
type that then gets shifted .. then after that cast to 64bit.

found by PVS studio

@fix

src/lib/evas/canvas/evas_callbacks.c
src/lib/evas/include/evas_inline.x

index a6f3ee4..184b500 100644 (file)
@@ -708,7 +708,7 @@ _check_event_catcher_add(void *data, const Efl_Event *event)
           }
         else if ((type = _legacy_evas_callback_type(array[i].desc)) != EVAS_CALLBACK_LAST)
           {
-             obj->callback_mask |= (1 << type);
+             obj->callback_mask |= (((uint64_t)1) << type);
           }
      }
 }
index 3093a94..f17e8b3 100644 (file)
@@ -47,7 +47,7 @@ _evas_object_event_new(void)
 static inline Eina_Bool
 _evas_object_callback_has_by_type(Evas_Object_Protected_Data *obj, Evas_Callback_Type type)
 {
-   return (obj->callback_mask & (1 << type)) != 0;
+   return (obj->callback_mask & (((uint64_t)1) << type)) != 0;
 }
 
 static inline int