This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hello, I noticed a SIGSEGV inside GDB while reading the symbol table. What GDB does with each symbol is try to compute their demangled name. The SEGV occured because the compiler I used (GNAT) generated a symbol which the demangle did not like: _test_array__L_1__B23b___clean.6 GDB basically called cplus_demangle() with the above name, and kaboom! SIGSEGV inside work_stuff_copy_to_from(). What happened is that cplus_demangle() ends up trying to demangle the symbol using gnu_special() which tries to see if the symbol is a template by calling demangle_template(). The value given for parameter REMEMBER is 1, so the first thing the function does is registering a Btype inside the work_stuff structure. But as it realizes it actually is not a template, it aborts the execution and returns zero. However, the work->btypevec vector now contains a NULL entry. When the code later tries to make a copy of the work_stuff structure, if segfaults because it's trying to copy a NULL string. I think the right fix is to only register the Btype when we know we are going to store it. In the present case, the attached patch seemed to be the right fix. I also attached a patch for the testsuite. The testdriver segfaults before I apply my patch, and runs to completion after. The output is unchanged. 2003-10-19 J. Brobecker <brobecker@gnat.com> * cplus-dem.c (demangle_template): Register a new Btype only when needed. * testsuite/demangle-expected: Add a new test. OK to apply? Thanks, -- Joel
Attachment:
libiberty.diff
Description: cplus-dem.c.diff
Attachment:
demangle-expected.diff
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |