Fix integer overflow issue 07/319007/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Mon, 3 Feb 2025 02:57:54 +0000 (11:57 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Mon, 3 Feb 2025 05:54:56 +0000 (14:54 +0900)
Undefined behavior: an integer underflow may occur due to arithmetic operation (multiplication) between variables 'y' and 'w', which are equal to '2' and '-2147483648' respectively

Change-Id: I7e658cf809ce97f2112093278fb310ceee9efbe4
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
scl/sclgraphics-nui.cpp

index 42e56797041a47c125a1001f386bb3e6860e2f9b..ecfb9f35d39cbc6d36e67eaa5373044d6db43711 100644 (file)
@@ -147,7 +147,12 @@ SclNinePatchInfo get_nine_patch_info_from_png_file(Evas_Object *image_data, scli
 {
     /* FIXME : Assuming we're dealing with 32bit image, need to check if there's any other cases */
     SclNinePatchInfo ret = {0};
-    unsigned int *data = (unsigned int*)evas_object_image_data_get(image_data, EINA_FALSE);
+    unsigned int *data = NULL;
+
+    if (w < 0 || h < 0) return ret;
+
+    data = (unsigned int*)evas_object_image_data_get(image_data, EINA_FALSE);
+
     if (data) {
         int x, y;
         sclboolean found;