This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: PR ld/10363: objdump -T crashes on corrupted file
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: binutils at sources dot redhat dot com
- Date: Mon, 3 Aug 2009 06:59:02 -0700
- Subject: PATCH: PR ld/10363: objdump -T crashes on corrupted file
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Hi,
We shouldn't return a valid string on an invalid string offset. OK to
install?
Thanks.
H.J.
----
2009-08-30 H.J. Lu <hongjiu.lu@intel.com>
PR ld/10363
* elf.c (bfd_elf_string_from_elf_section): Return NULL on
invalid string offset.
Index: bfd/elf.c
===================================================================
--- bfd/elf.c (revision 6507)
+++ bfd/elf.c (working copy)
@@ -331,7 +331,7 @@ bfd_elf_string_from_elf_section (bfd *ab
(shindex == shstrndx && strindex == hdr->sh_name
? ".shstrtab"
: bfd_elf_string_from_elf_section (abfd, shstrndx, hdr->sh_name)));
- return "";
+ return NULL;
}
return ((char *) hdr->contents) + strindex;