Merge pull request #3898 from c1728p9/fix_heap_size_calculation

Prevent underflow in heap size calculation
pull/3294/merge
Martin Kojtal 2017-03-09 15:35:32 +00:00 committed by GitHub
commit fefa91fc6e
1 changed files with 1 additions and 1 deletions

View File

@ -478,7 +478,7 @@ void set_stack_heap(void) {
mbed_stack_isr_start = ISR_STACK_START;
#else
/* Interrupt stack - reserve space at the end of the free block */
mbed_stack_isr_size = ISR_STACK_SIZE;
mbed_stack_isr_size = ISR_STACK_SIZE < free_size ? ISR_STACK_SIZE : free_size;
mbed_stack_isr_start = free_start + free_size - mbed_stack_isr_size;
free_size -= mbed_stack_isr_size;
#endif