From: Paul Pluzhnikov <ppluzhnikov@google.com>
To: gdb-patches ml <gdb-patches@sourceware.org>
Cc: Holger Freyther <zecke@selfish.org>
Subject: [patch] Fix for excessive stack use (gdb/10457)
Date: Thu, 08 Oct 2009 05:29:00 -0000 [thread overview]
Message-ID: <8ac60eac0910072229s432c6480k5788878ca414b255@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 261 bytes --]
Greetings,
Calling alloca in a loop is a bad idea.
Here is a fix for gdb/10457; rather on the obvious side.
Thanks,
--
Paul Pluzhnikov
2009-10-07 Paul Pluzhnikov <ppluzhnikov@google.com>
* elfread.c (elf_symtab_read): Don't use alloca in a loop.
[-- Attachment #2: gdb-pr10457-20091007.txt --]
[-- Type: text/plain, Size: 857 bytes --]
Index: elfread.c
===================================================================
RCS file: /cvs/src/src/gdb/elfread.c,v
retrieving revision 1.77
diff -p -u -r1.77 elfread.c
--- elfread.c 30 Apr 2009 21:59:03 -0000 1.77
+++ elfread.c 8 Oct 2009 05:22:49 -0000
@@ -535,7 +535,7 @@ elf_symtab_read (struct objfile *objfile
if (len > 4 && strcmp (sym->name + len - 4, "@plt") == 0)
{
- char *base_name = alloca (len - 4 + 1);
+ char *base_name = xmalloc (len - 4 + 1);
struct minimal_symbol *mtramp;
memcpy (base_name, sym->name, len - 4);
@@ -543,6 +543,7 @@ elf_symtab_read (struct objfile *objfile
mtramp = record_minimal_symbol (base_name, symaddr,
mst_solib_trampoline,
sym->section, objfile);
+ xfree (base_name);
if (mtramp)
{
MSYMBOL_SIZE (mtramp) = MSYMBOL_SIZE (msym);
next reply other threads:[~2009-10-08 5:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-08 5:29 Paul Pluzhnikov [this message]
2009-10-08 16:20 ` Joel Brobecker
2009-10-08 16:40 ` Paul Pluzhnikov
2009-10-08 17:35 ` Joel Brobecker
2009-10-09 1:42 ` Holger Freyther
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8ac60eac0910072229s432c6480k5788878ca414b255@mail.gmail.com \
--to=ppluzhnikov@google.com \
--cc=gdb-patches@sourceware.org \
--cc=zecke@selfish.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox