Skip to content

Commit

Permalink
Improve sanity check on vector table address (#1452)
Browse files Browse the repository at this point in the history
***NO_CI***
  • Loading branch information
antoniofagundes authored and josesimoes committed Oct 10, 2019
1 parent 1ec952e commit 363367f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion targets/CMSIS-OS/ChibiOS/common/LaunchCLR.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ bool CheckValidCLRImage(uint32_t address)
// see os\common\startup\ARMCMx\compilers\GCC\vectors.S

// sanity check for invalid address (out of flash range which causes a hard fault)
if( (uint32_t)((uint32_t*)nanoCLRVectorTable->reset_handler) > (FLASH1_MEMORY_StartAddress + FLASH1_MEMORY_Size) )
if( (uint32_t)((uint32_t*)nanoCLRVectorTable->reset_handler) <= FLASH1_MEMORY_StartAddress ||
(uint32_t)((uint32_t*)nanoCLRVectorTable->reset_handler) >= (FLASH1_MEMORY_StartAddress + FLASH1_MEMORY_Size) )
{
// check failed, doesn't seem to be a valid CLR image
return false;
Expand Down

0 comments on commit 363367f

Please sign in to comment.