From 6edf6f8dae89b6bf3e65a7e13f877059f5201480 Mon Sep 17 00:00:00 2001 From: "a.adaszkiewi" Date: Fri, 28 Feb 2025 10:38:38 +0100 Subject: [PATCH] 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 --- src/upgrade-apply/patch/patch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.34.1