aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf-eh-frame.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2011-06-14 12:57:18 +0000
committerAlan Modra <amodra@gmail.com>2011-06-14 12:57:18 +0000
commit4d16d5754ec1e71d5e0b590a5b0ecdda95892f14 (patch)
treef10492d09ae824fb86d4e32e8ff19212b5d1d322 /bfd/elf-eh-frame.c
parent2fb4b302aae40bf05c70dbcfb34a14959435354f (diff)
downloadgdb-4d16d5754ec1e71d5e0b590a5b0ecdda95892f14.zip
gdb-4d16d5754ec1e71d5e0b590a5b0ecdda95892f14.tar.gz
gdb-4d16d5754ec1e71d5e0b590a5b0ecdda95892f14.tar.bz2
PR ld/12887
* elf-eh-frame.c (_bfd_elf_parse_eh_frame): Check sec_info_type before doing anything. (_bfd_elf_discard_section_eh_frame): Likewise.
Diffstat (limited to 'bfd/elf-eh-frame.c')
-rw-r--r--bfd/elf-eh-frame.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c
index 0a22138..21041a5 100644
--- a/bfd/elf-eh-frame.c
+++ b/bfd/elf-eh-frame.c
@@ -1,5 +1,5 @@
/* .eh_frame section optimization.
- Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+ Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
Written by Jakub Jelinek <jakub@redhat.com>.
@@ -490,7 +490,8 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info,
if (hdr_info->parsed_eh_frames)
return;
- if (sec->size == 0)
+ if (sec->size == 0
+ || sec->sec_info_type != ELF_INFO_TYPE_NONE)
{
/* This file does not contain .eh_frame information. */
return;
@@ -1133,6 +1134,9 @@ _bfd_elf_discard_section_eh_frame
struct eh_frame_hdr_info *hdr_info;
unsigned int ptr_size, offset;
+ if (sec->sec_info_type != ELF_INFO_TYPE_EH_FRAME)
+ return FALSE;
+
sec_info = (struct eh_frame_sec_info *) elf_section_data (sec)->sec_info;
if (sec_info == NULL)
return FALSE;