From: a.adaszkiewi Date: Fri, 28 Feb 2025 09:38:38 +0000 (+0100) Subject: upgrade-apply: Fix parsing overflow X-Git-Tag: accepted/tizen/unified/20250304.070213^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Faccepted%2Ftizen_unified_x;p=platform%2Fcore%2Fsystem%2Fupgrade.git upgrade-apply: Fix parsing overflow Previous mask was equal to max 32-bit signed int, resulting in an overflow for larger values. Change-Id: I2ecf7d37928522fb22f888fae485731cca5aef24 --- diff --git a/src/upgrade-apply/patch/patch.c b/src/upgrade-apply/patch/patch.c index 93989ae..5fb9da6 100644 --- a/src/upgrade-apply/patch/patch.c +++ b/src/upgrade-apply/patch/patch.c @@ -298,7 +298,7 @@ static int64_t parse_ssint(unsigned char *buff) * (In other words, an INTEGER is a 64-byte signed integer in sign-magnitude * format, stored in little-endian byte order.) */ - int64_t result = *(int64_t*)buff & 0x7fffffff; + int64_t result = *(int64_t*)buff & 0x7fffffffffffffff; if ((buff[7] & 0x80) != 0) result = -result;