From: Jihoon Kim Date: Mon, 3 Feb 2025 02:57:54 +0000 (+0900) Subject: Fix integer overflow issue X-Git-Tag: accepted/tizen/unified/20250203.162337~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d39159aca7892d413b75968611c7f9c2a3e93cdd;p=platform%2Fcore%2Fuifw%2Flibscl-ui-nui.git Fix integer overflow issue 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 --- diff --git a/scl/sclgraphics-nui.cpp b/scl/sclgraphics-nui.cpp index 42e5679..ecfb9f3 100644 --- a/scl/sclgraphics-nui.cpp +++ b/scl/sclgraphics-nui.cpp @@ -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;