-
Notifications
You must be signed in to change notification settings - Fork 128
-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] wrong lwip_assert in pbuf_realloc when pbuf is the last buf of ram_heap (IDFGH-10811) #58
Comments
I concur with your findings, although I'm not too familiar with the code and most importantly this code is not used in ESP-IDF's port. I can only comment, that the algorithm used for reallocation needs an extra space in the heap to allocate a new chunk and free the current one, then after adjusting the But since this is not used within Espressif port, and I don't feel confident enough to update it, I'd suggest posting a patch to lwip upstream. Please let me know if you need some help with designing a test case that exhibits this issue. You simply add a new test next to this: esp-lwip/test/unit/core/test_mem.c Lines 30 to 31 in 4f24c9b
writing what you described above in the code: p1 = mem_malloc(MEM_SIZE_ALIGNED - ((SIZEOF_STRUCT_MEM + MEM_SANITY_OFFSET)));
fail_unless(p1 != NULL);
mem_trim(p1, 16); |
Closing per the explanation above. |
Wrong LWIP_ASSERT is here,
https://github.com/espressif/esp-lwip/blob/4f24c9baf9101634b7c690802f424b197b3bb685/src/core/mem.c#L818C7-L818C7
when pbuf is the last buf of ram_heap, 'mem->next' would be 'MEM_SIZE_ALIGNED', so will trigger LWIP_ASSERT;
The testcase would be like this:
so, I think this LWIP_ASSERT should be removed, Please CHECK it again, Thanks.
The text was updated successfully, but these errors were encountered: