Skip to content

Commit a176186

Browse files
authored
Merge pull request #59 from rahmanih/fix_issue_58
fix: "array out of bounds" error leading to memory corruption
2 parents 5783f64 + b5dcbff commit a176186

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
22

33
# Set up the project
44
project(levelx

common/src/lx_nor_flash_extended_cache_enable.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ ULONG block_word;
290290

291291
/* Loop through the memory supplied and assign to cache entries. */
292292
i = 0;
293-
while (cache_size >= LX_NOR_SECTOR_SIZE)
293+
while ((cache_size >= LX_NOR_SECTOR_SIZE) && (i < LX_NOR_EXTENDED_CACHE_SIZE))
294294
{
295295

296296
/* Setup this cache entry. */
@@ -309,7 +309,7 @@ ULONG block_word;
309309
}
310310

311311
/* Save the number of cache entries. */
312-
if(i > LX_NOR_EXTENDED_CACHE_SIZE)
312+
if(i == LX_NOR_EXTENDED_CACHE_SIZE)
313313
{
314314

315315
nor_flash -> lx_nor_flash_extended_cache_entries = LX_NOR_EXTENDED_CACHE_SIZE;

0 commit comments

Comments
 (0)