https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98889
Bug ID: 98889
Summary: stack overflow in cxxfilt, peek, rust-demangle.c:85
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: demangler
Assignee: unassigned at gcc dot gnu.org
Reporter: featherrain26 at gmail dot com
Target Milestone: ---
Created attachment 50085
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50085&action=edit
POC
Hi, there.
There is a stack overflow in the newest version(2eda57ef) of cxxfilt,
rust-demangle.c:85 related to path demangling, which directly causes a
segmentation fault.
To reproduce, run
cxxfilt < poc
Here is the trace reported by ASAN:
ASAN:SIGSEGV
=================================================================
==52498==ERROR: AddressSanitizer: stack-overflow on address 0x7ffeeb551ff8 (pc
0x0000009768c0 bp 0x7ffeebd4f8b0 sp 0x7ffeeb551ff8 T0)
#0 0x9768bf in peek ../../libiberty/rust-demangle.c:85
#1 0x9768bf in next ../../libiberty/rust-demangle.c:105
#2 0x9768bf in demangle_path ../../libiberty/rust-demangle.c:674
SUMMARY: AddressSanitizer: stack-overflow ../../libiberty/rust-demangle.c:85
peek
==52498==ABORTING