Created attachment 14033 [details] poc for nm-new ### short description in the latest commit there is a stack-overflow in nm-new, which can be triggered via a crafted elf file. ### step to reproduce compile using CC="clang -fsanitize=address" CXX="clang++ -fsanitize=address" ./configure --disable-shared && make -j$(nproc) ./nm-new -C $POC ### ASAN output 00000000 A pRYAaca_NRYAaca_a 00000000 A _RYAa 00000000 A _RYAaca_a 00000000 A _RYAaca_a 00000000 A _RYAaca_a AddressSanitizer:DEADLYSIGNAL ================================================================= ==24336==ERROR: AddressSanitizer: stack-overflow on address 0x7fffff7fef60 (pc 0x0000007b5cc7 bp 0x7fffff7ff110 sp 0x7fffff7fef60 T0) #0 0x7b5cc6 (/home/hzheng/workspace/reproduce/binutils-gdb/binutils/nm-new+0x7b5cc6) #1 0x7b65df (/home/hzheng/workspace/reproduce/binutils-gdb/binutils/nm-new+0x7b65df) #2 0x7b65df (/home/hzheng/workspace/reproduce/binutils-gdb/binutils/nm-new+0x7b65df) #3 0x7b65df (/home/hzheng/workspace/reproduce/binutils-gdb/binutils/nm-new+0x7b65df) #4 0x7b65df (/home/hzheng/workspace/reproduce/binutils-gdb/binutils/nm-new+0x7b65df) ... #249 0x7b65df (/home/hzheng/workspace/reproduce/binutils-gdb/binutils/nm-new+0x7b65df) SUMMARY: AddressSanitizer: stack-overflow (/home/hzheng/workspace/reproduce/binutils-gdb/binutils/nm-new+0x7b5cc6) ==24336==ABORTING ### environment Ubuntu 18.04.6 LTS clang version 6.0.0-1ubuntu2 binutils faf5e6ace8c6f82e11ad40393f531123515ce3e6 ### Credit Han Zheng, nipc
reproduced with debug information in WSL Ubuntu 20.04.1 LTS, clang-10.0.0 00000000 A _RYAa AddressSanitizer:DEADLYSIGNAL ================================================================= ==10123==ERROR: AddressSanitizer: stack-overflow on address 0x7ffffb96cf40 (pc 0x0000007675ab bp 0x7ffffb96d0f0 sp 0x7ffffb96cf40 T0) #0 0x7675ab in demangle_const /mnt/c/Users/hzheng/Desktop/test/reproduce/nm-new/binutils-gdb/libiberty/./rust-demangle.c:1144 #1 0x767e06 in demangle_const /mnt/c/Users/hzheng/Desktop/test/reproduce/nm-new/binutils-gdb/libiberty/./rust-demangle.c:1158:11 ... #248 0x767e06 in demangle_const /mnt/c/Users/hzheng/Desktop/test/reproduce/nm-new/binutils-gdb/libiberty/./rust-demangle.c:1158:11 SUMMARY: AddressSanitizer: stack-overflow /mnt/c/Users/hzheng/Desktop/test/reproduce/nm-new/binutils-gdb/libiberty/./rust-demangle.c:1144 in demangle_const ==10123==ABORTING
In future, please report demangler bugs to the gcc project (which owns most libiberty files). Move to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105039
Ack, thanks
Fix Credit ### Credit NCNIPC of China, Hexhive