* [patch] Fix crash in read_dbx_symtab
@ 2009-07-24 17:25 Paul Pluzhnikov
2009-07-29 19:24 ` Tom Tromey
0 siblings, 1 reply; 2+ messages in thread
From: Paul Pluzhnikov @ 2009-07-24 17:25 UTC (permalink / raw)
To: gdb-patches; +Cc: ppluzhnikov
Greetings,
This checkin:
2009-03-31 Daniel Jacobowitz <dan@codesourcery.com>
Keith Seitz <keiths@redhat.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
PR gdb/6817
* Makefile.in (dbxread.o): Update.
* dbxread.c (read_dbx_symtab): Use cp_canonicalize_string.
...
Introduced an alloca in a loop for each symbol, which causes GDB
to run out of stack and crash when stack is limited (e.g.
'ulimit -s' == 8192) and the executable has a lot of long STABs
(C++ N_LSYMs in my test case).
Here is a proposed fix.
Thanks,
--
Paul Pluzhnikov
2009-07-24 Paul Pluzhnikov <ppluzhnikov@google.com>
PR gdb/6817
* dbxread.c (read_dbx_symtab): Reduce stack use.
Index: dbxread.c
===================================================================
RCS file: /cvs/src/src/gdb/dbxread.c,v
retrieving revision 1.104
diff -u -p -u -r1.104 dbxread.c
--- dbxread.c 29 Jun 2009 16:48:15 -0000 1.104
+++ dbxread.c 24 Jul 2009 16:39:03 -0000
@@ -1689,7 +1689,7 @@ pos %d"),
sym_name = NULL; /* pacify "gcc -Werror" */
if (psymtab_language == language_cplus)
{
- char *new_name, *name = alloca (p - namestring + 1);
+ char *new_name, *name = xmalloc (p - namestring + 1);
memcpy (name, namestring, p - namestring);
name[p - namestring] = '\0';
new_name = cp_canonicalize_string (name);
@@ -1700,6 +1700,7 @@ pos %d"),
&objfile->objfile_obstack);
xfree (new_name);
}
+ xfree (name);
}
if (sym_len == 0)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch] Fix crash in read_dbx_symtab
2009-07-24 17:25 [patch] Fix crash in read_dbx_symtab Paul Pluzhnikov
@ 2009-07-29 19:24 ` Tom Tromey
0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2009-07-29 19:24 UTC (permalink / raw)
To: Paul Pluzhnikov; +Cc: gdb-patches
>>>>> "Paul" == Paul Pluzhnikov <ppluzhnikov@google.com> writes:
Paul> 2009-07-24 Paul Pluzhnikov <ppluzhnikov@google.com>
Paul> PR gdb/6817
Paul> * dbxread.c (read_dbx_symtab): Reduce stack use.
This is ok.
There's also the maybe-related PR 10457. If you're looking for
something to do ;)
Tom
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-07-29 18:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-24 17:25 [patch] Fix crash in read_dbx_symtab Paul Pluzhnikov
2009-07-29 19:24 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox