Fix addrss violation when processing a corrupt SH COFF binary.

PR binutils/21646
	* coff-sh.c (sh_reloc): Check for an out of range reloc.
This commit is contained in:
Nick Clifton 2017-06-21 16:36:44 +01:00
parent 2234eee61c
commit 6879f5a99e
2 changed files with 8 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2017-06-21 Nick Clifton <nickc@redhat.com>
PR binutils/21646
* coff-sh.c (sh_reloc): Check for an out of range reloc.
2017-06-21 Nick Clifton <nickc@redhat.com>
PR binutils/21639

View File

@ -596,6 +596,9 @@ sh_reloc (bfd * abfd,
&& bfd_is_und_section (symbol_in->section))
return bfd_reloc_undefined;
if (addr > input_section->size)
return bfd_reloc_outofrange;
sym_value = get_symbol_value (symbol_in);
switch (r_type)
@ -2910,7 +2913,6 @@ sh_coff_get_relocated_section_contents (bfd *output_bfd,
struct internal_reloc *internal_relocs = NULL;
struct internal_syment *internal_syms = NULL;
fprintf (stderr, "DATA = %p\n", data);
/* We only need to handle the case of relaxing, or of having a
particular set of section contents, specially. */
if (relocatable