From: SangYoun Kwak Date: Mon, 30 Dec 2024 09:38:41 +0000 (+0900) Subject: SS_FSUpdate: Fix to cast into bigger type before operation X-Git-Tag: accepted/tizen/9.0/unified/20250102.114454~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a7edc2277f0103cab39d032cc6a3b74cc3930aa1;p=platform%2Fcore%2Fsystem%2Fupgrade.git SS_FSUpdate: Fix to cast into bigger type before operation Since the operands are int, SS_UINT32(unsigned int) and long type, it is required to cast them into a big enough type before adding them. (Thier value are all non-negative values) To resolve this issue, operands are casted to uint64_t, which is big enough to store the value of the variables and the result of the arithmetic operation. Change-Id: Iecf8ffa3be11984ce6fdc3d850f9b9c9f74c7186 Signed-off-by: SangYoun Kwak --- diff --git a/src/upgrade-apply-deltafs/engine/SS_FSUpdate.c b/src/upgrade-apply-deltafs/engine/SS_FSUpdate.c index db4b661..08d585c 100644 --- a/src/upgrade-apply-deltafs/engine/SS_FSUpdate.c +++ b/src/upgrade-apply-deltafs/engine/SS_FSUpdate.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -484,7 +485,7 @@ SS_ReadFile(long wHandle, return E_SS_READ_ERROR; } - if ((unsigned int)ret != dwSize && (((unsigned long)ret + (unsigned long)dwPosition) != (unsigned long)SS_GetFileSize(wHandle))) + if ((unsigned int)ret != dwSize && (((uint64_t)ret + (uint64_t)dwPosition) != (uint64_t)SS_GetFileSize(wHandle))) return E_SS_READ_ERROR; pbBuffer[ret] = '\0';