From 5b9fb1a70172d8353cd66b8c0b93edacccf69ecf Mon Sep 17 00:00:00 2001 From: seongwoo chae Date: Wed, 31 Jan 2024 06:21:18 +0900 Subject: [PATCH] Prevent overflow from bit shifting (#12566) This commit prevents an overflow from bit shifting. ONE-DCO-1.0-Signed-off-by: seongwoo --- compiler/luci-interpreter/include/luci_interpreter/BuddyMemoryManager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/luci-interpreter/include/luci_interpreter/BuddyMemoryManager.h b/compiler/luci-interpreter/include/luci_interpreter/BuddyMemoryManager.h index 205baa6..fec0899 100644 --- a/compiler/luci-interpreter/include/luci_interpreter/BuddyMemoryManager.h +++ b/compiler/luci-interpreter/include/luci_interpreter/BuddyMemoryManager.h @@ -114,7 +114,7 @@ private: const int32_t l = lowerLog2(block->size + sizeof(Block)); const int64_t address = ((uint8_t *)block - (uint8_t *)_start_block); - buddy = (Block *)((address ^ (1 << l)) + (uint8_t *)_start_block); + buddy = (Block *)((address ^ (1LL << l)) + (uint8_t *)_start_block); if (!buddy->is_free || buddy->size != block->size) return nullptr; -- 2.7.4