From 883433b2603249e41c6112ae52db48f044f7a607 Mon Sep 17 00:00:00 2001 From: Andrey Andreyevich Bienkowski Date: Wed, 18 Dec 2024 23:49:16 +0300 Subject: [PATCH] includes/type: Fix parsing of signed leb128 (#333) --- includes/type/leb128.pat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/type/leb128.pat b/includes/type/leb128.pat index 04d857b6..b601b587 100644 --- a/includes/type/leb128.pat +++ b/includes/type/leb128.pat @@ -43,7 +43,7 @@ namespace auto type { fn transform_sleb128_array(ref auto array) { s128 res = type::impl::transform_uleb128_array(array); - if (res & 0x40 != 0) { + if (res & 1 << ((sizeof(array) / sizeof(u8)) * 7 - 1) != 0) { res |= ~0 << (sizeof(array) / sizeof(u8)) * 7; } return res;