This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[committed]: PATCH: Return NULL on corrupt input
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: binutils at sourceware dot org
- Date: Tue, 6 Jan 2015 16:47:57 -0800
- Subject: [committed]: PATCH: Return NULL on corrupt input
- Authentication-results: sourceware.org; auth=none
- References: <20150106014517 dot GA31762 at intel dot com>
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
On Mon, Jan 05, 2015 at 05:45:17PM -0800, H.J. Lu wrote:
> Hi,
>
> I checked in this patch to return NULL on corrupt input.
>
>
It is better just to skip unknown relocation. I checked it in.
H.J.
---
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 10ffe34..3483d79 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2015-01-06 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/17512
+ * elf32-i386.c (elf_i386_get_plt_sym_val): Skip unknown relocation.
+ * elf64-x86-64.c (elf_x86_64_get_plt_sym_val): Likewise.
+
2015-01-06 Nick Clifton <nickc@redhat.com>
PR binutils/17512
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index cf072a3..a6c8faa 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -5194,9 +5194,9 @@ bad_return:
{
long reloc_index;
- /* PR 17512: file: bc9d6cf5. */
+ /* Skip unknown relocation. PR 17512: file: bc9d6cf5. */
if (p->howto == NULL)
- goto bad_return;
+ continue;
if (p->howto->type != R_386_JUMP_SLOT
&& p->howto->type != R_386_IRELATIVE)
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 5cbb6fd..581ee17 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -5559,8 +5559,9 @@ bad_return:
{
long reloc_index;
+ /* Skip unknown relocation. */
if (p->howto == NULL)
- goto bad_return;
+ continue;
if (p->howto->type != R_X86_64_JUMP_SLOT
&& p->howto->type != R_X86_64_IRELATIVE)