mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-11 07:25:19 +00:00
The adjacent overlap case in test_memmove() placed the source at a fixed g_buf1 + align + 64 and the destination one size further, so the destination tail reached align + 64 + 2 * size. g_buf1 is only TEST_BUF_SIZE + MAX_ALIGN (528) bytes, so the larger swept sizes ran off the end: align=0 with size=255 writes up to offset 573, that is 46 bytes past the object. AddressSanitizer aborted arch_libctest with a global-buffer-overflow. Start the adjacent layout at g_buf1 + align instead. The tail then reaches align + 2 * size, which is at most 7 + 2 * 257 = 521 and stays inside g_buf1 for every alignment and boundary size that is swept, while still keeping source and destination exactly adjacent. Impact: test only, selected by CONFIG_TESTING_ARCH_LIBC (default n). Testing: built and ran sim:nsh on Linux x86_64 (Ubuntu 24.04, gcc 13.3.0) with CONFIG_TESTING_ARCH_LIBC=y. memmove reports PASSED with no sanitizer report, and "arch_libc_test Passed". Assisted-by: Claude:claude-opus-5 Signed-off-by: dengwenqi <dengwenqi@xiaomi.com> |
||
|---|---|---|
| .. | ||
| arch | ||
| cmocka | ||
| crypto | ||
| cxx | ||
| cxx-oot-build | ||
| drivers | ||
| enet | ||
| fff | ||
| fs | ||
| libc | ||
| ltp | ||
| mm | ||
| nettest | ||
| nuts | ||
| ostest | ||
| sched | ||
| sig_sp_test | ||
| testsuites | ||
| unity | ||
| .gitignore | ||
| CMakeLists.txt | ||
| Make.defs | ||
| Makefile | ||