e_comp_wl: fix overflow issue 14/305914/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Tue, 13 Feb 2024 10:04:38 +0000 (19:04 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Tue, 13 Feb 2024 10:20:46 +0000 (19:20 +0900)
Expression cancel_keycode - 8U, which is equal to 4294967288, where cancel_keycode is known to be equal to 0, underflows the type that receives it, an unsigned integer 32 bits wide.

Change-Id: I3fc0178cc2159b123b5d2c637c813b958132f31f
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/bin/e_comp_wl.c

index 7f13532..0232c7b 100644 (file)
@@ -4737,8 +4737,10 @@ e_comp_wl_key_cancel(E_Client *ec, int keycode, Ecore_Device *dev, uint32_t time
         ELOGF("Key", "Failed to send key cancel for %d key, Cancel key is not supported\n", ec, keycode);
         return EINA_FALSE;
      }
+
+   EINA_SAFETY_ON_TRUE_RETURN_VAL(cancel_keycode < 8, EINA_FALSE);
+
    cancel_keycode = cancel_keycode - 8;
-   EINA_SAFETY_ON_TRUE_RETURN_VAL(cancel_keycode <= 0, EINA_FALSE);
 
    wl_keycode = keycode - 8;
    EINA_SAFETY_ON_TRUE_RETURN_VAL(wl_keycode <= 0, EINA_FALSE);