[Bug libstdc++/96345] New: __cxa demangle fails to demangle a very long string

hededrk at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Jul 27 19:55:37 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96345

            Bug ID: 96345
           Summary: __cxa demangle fails to demangle a very long string
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hededrk at gmail dot com
  Target Milestone: ---

I found this bug because one of my tests started to fail (not sure when it
started to fail because I've set up CI only yesterday). I assume this is a bug
because GCC is able to produce such names.

Steps to reproduce:
1. compile attached file
        g++ -c cxa_demangle_fail.cpp

2. obtain mangled name with nm
        nm cxa_demangle_fail.o

3. pass that name into abi::__cxa_demangle
        auto name   = /*long string*/;
        size_t size = 1024;
        auto memory = static_cast<char*>(malloc(size));

        int status;
        auto demangled = abi::__cxa_demangle(name, memory, &size, &status);

Result: __cxa_demangle fails with code -2.


More information about the Gcc-bugs mailing list