From 7d1ef20acf69375cda756060b1de339b2e20a299 Mon Sep 17 00:00:00 2001 From: Haithem Rahmani Date: Wed, 22 Oct 2025 16:08:53 +0100 Subject: [PATCH 1/2] fix: "array out of bounds" error leading to memory corruption Fix description ---------------- add missing checks on the index of nor_flash -> lx_nor_flash_extended_cache[i] Fixes Issue#58 Signed-off-by: Haithem Rahmani --- common/src/lx_nor_flash_extended_cache_enable.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/src/lx_nor_flash_extended_cache_enable.c b/common/src/lx_nor_flash_extended_cache_enable.c index 86b3673..2b31afb 100644 --- a/common/src/lx_nor_flash_extended_cache_enable.c +++ b/common/src/lx_nor_flash_extended_cache_enable.c @@ -290,7 +290,7 @@ ULONG block_word; /* Loop through the memory supplied and assign to cache entries. */ i = 0; - while (cache_size >= LX_NOR_SECTOR_SIZE) + while ((cache_size >= LX_NOR_SECTOR_SIZE) && (i < LX_NOR_EXTENDED_CACHE_SIZE)) { /* Setup this cache entry. */ @@ -309,7 +309,7 @@ ULONG block_word; } /* Save the number of cache entries. */ - if(i > LX_NOR_EXTENDED_CACHE_SIZE) + if(i == LX_NOR_EXTENDED_CACHE_SIZE) { nor_flash -> lx_nor_flash_extended_cache_entries = LX_NOR_EXTENDED_CACHE_SIZE; From b5dcbff38c7c908a68bff2d4efbf88d855b8b270 Mon Sep 17 00:00:00 2001 From: Haithem Rahmani Date: Wed, 22 Oct 2025 16:08:53 +0100 Subject: [PATCH 2/2] fix: "array out of bounds" error leading to memory corruption Fix description ---------------- add missing checks on the index of nor_flash -> lx_nor_flash_extended_cache[i] Fixes Issue#58 Signed-off-by: Haithem Rahmani --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index db1b87d..b4c1e06 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR) +cmake_minimum_required(VERSION 3.13 FATAL_ERROR) # Set up the project project(levelx