memory allocation bug in LWIP mem.c?
As far as I can tell, there is a bug in mem_init() in mem.c this can cause a memory overrun and hard fault (if you're lucky)
In lwipopts.h I set
LWIP_RAM_HEAP_POINTER = 0x30004000
MEM_SIZE 0x4000
I would expect the pool to be from 0x30004000 to 0x30007FFF
however mem_init() has this code
ram_end = ptr_to_mem(MEM_SIZE_ALIGNED);
ram_end->used = 1;
ram_end->next = MEM_SIZE_ALIGNED;
ram_end->prev = MEM_SIZE_ALIGNED;
ram_end is set to 0x30008000 and the instruction 'ram_end->used = 1' writes beyond the allocated memory, and in my case outside the memory_segment and hard faults. If the pool is elsewhere it'll overwite the next address outside the pool - eek.
using STM32Cube_FW_H7_V1.11.2
path to file
STM32Cube_FW_H7_V1.11.2\Middlewares\Third_Party\LwIP\src\core\mem.c
but same code in F4, and others I guess.
