public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "H. J. Lu" <hjl@lucon.org>
To: Nick Clifton <nickc@redhat.com>
Cc: Mike Frysinger <vapier@gentoo.org>, binutils@sources.redhat.com
Subject: Re: BFD overflows (part 2)
Date: Tue, 17 May 2005 22:00:00 -0000	[thread overview]
Message-ID: <20050517212911.GA30925@lucon.org> (raw)
In-Reply-To: <428A330B.3050601@redhat.com>

On Tue, May 17, 2005 at 07:08:11PM +0100, Nick Clifton wrote:
> Hi Mike,
> 
> >strings.095:
> >Program received signal SIGSEGV, Segmentation fault.
> >0x0000000000418678 in bfd_elf_string_from_elf_section (abfd=0x4643a0, 
> >    shindex=5784064, strindex=47) at elf.c:280
> 
> This was a nasty one - the file was stimulating an infinite loop inside 
> the code in elf.c between group_signature() and bfd_section_from_shdr(). 
>  Anyway I will be checking in the attached patch to catch and prevent 
> this occurring in the future.
> 

I prefer this patch.


H.J.
---
2005-05-17  H.J. Lu  <hongjiu.lu@intel.com>

	* elf.c (group_signature): Check if the symbol table section is
	correct.

--- bfd/elf.c.bad	2005-05-17 10:32:52.000000000 -0700
+++ bfd/elf.c	2005-05-17 14:27:10.000000000 -0700
@@ -452,8 +452,11 @@ group_signature (bfd *abfd, Elf_Internal
   Elf_External_Sym_Shndx eshndx;
   Elf_Internal_Sym isym;
 
-  /* First we need to ensure the symbol table is available.  */
-  if (! bfd_section_from_shdr (abfd, ghdr->sh_link))
+  /* First we need to ensure the symbol table is available.  Make sure
+     that it is a symbol table section.  */
+  hdr = elf_elfsections (abfd) [ghdr->sh_link];
+  if (hdr->sh_type != SHT_SYMTAB
+      || ! bfd_section_from_shdr (abfd, ghdr->sh_link))
     return NULL;
 
   /* Go read the symbol.  */

  reply	other threads:[~2005-05-17 21:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-12 12:50 Mike Frysinger
2005-05-12 16:21 ` BFD overflows (part 2) [first patch] Mike Frysinger
2005-05-17 17:16   ` Nick Clifton
2005-05-17 18:25 ` BFD overflows (part 2) Nick Clifton
2005-05-17 22:00   ` H. J. Lu [this message]
2005-05-18  8:09     ` Nick Clifton

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=20050517212911.GA30925@lucon.org \
    --to=hjl@lucon.org \
    --cc=binutils@sources.redhat.com \
    --cc=nickc@redhat.com \
    --cc=vapier@gentoo.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).