I've built a little lwIp test program with
a small menu-like interface:
LwIP> h
m: print memory stats.
n: print TCP netstat.
p: print mem-pool stats.
S: print system stats.
s: print protocol stats.
h: this help.
i: print IPv4/IPv6 address, network-mask, gateway.
q: quit program.
Pressing 'p' calls this:
for (int i = 0; i < MEMP_MAX; i++)
MEMP_STATS_DISPLAY (i);
When building with clang-cl and ASAN (-fsanitize=address)
on Win-10, running it and pressing 'p', ASAN kicks in to
report this:
=================================================================
==9008==ERROR: AddressSanitizer: access-violation on unknown address 0x000000001788 (pc 0x7ff6b93a8c0e bp 0x0022928ffa60
sp 0x0022928ff780 T0)
==9008==The signal is caused by a READ memory access.
==9008==*** WARNING: Failed to initialize DbgHelp! ***
==9008==*** Most likely this means that the app is already ***
==9008==*** using DbgHelp, possibly with incompatible flags. ***
==9008==*** Due to technical reasons, symbolization might crash ***
==9008==*** or produce wrong results. ***
#0 0x7ff6b93a8c0d in stats_display_memp
F:\MinGW32\src\inet\lwip\src\core\stats.c:119
#1 0x7ff6b935eea9 in main_loop
F:\MinGW32\src\inet\lwip\contrib\ports\win32\test.c:1126
#2 0x7ff6b935eea9 in main
F:\MinGW32\src\inet\lwip\contrib\ports\win32\test.c:1229
#3 0x7ff6b94260f7 in invoke_main
D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
#4 0x7ff6b94260f7 in __scrt_common_main_seh
D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
#5 0x7ffcdee37373 (C:\Windows\System32\KERNEL32.DLL+0x180017373)
#6 0x7ffce085cc90 (C:\Windows\SYSTEM32\ntdll.dll+0x18004cc90)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: access-violation
F:\MinGW32\src\inet\lwip\src\core\stats.c:119 in stats_display_memp
==9008==ABORTING
I fail to understand why. A bug in 'stats.c' or my code?
The offending code is simply:
void
stats_display_memp(struct stats_mem *mem, int idx)
{
if (idx < MEMP_MAX) {
stats_display_mem(mem, mem->name); // line 119
}
}
Why isn't 'idx' used in the call here?
--
--gv
_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users