Commit de929842 authored by Thomas Preud'homme's avatar Thomas Preud'homme
Browse files

Assert we don't access htab->stub_group out of range

	2016-03-29  Thomas Preud'homme  <thomas.preudhomme@arm.com>

	bfd/
	* elf32-arm.c (elf32_arm_get_stub_entry): Assert that we don't access
	passed the end of htab->stub_group array.
	(elf32_arm_create_or_find_stub_sec): Likewise.
	(elf32_arm_create_stub): Likewise.
parent c16628bd
2016-03-29 Thomas Preud'homme <thomas.preudhomme@arm.com>
* elf32-arm.c (elf32_arm_get_stub_entry): Assert that we don't access
passed the end of htab->stub_group array.
(elf32_arm_create_or_find_stub_sec): Likewise.
(elf32_arm_create_stub): Likewise.
2016-03-29 Thomas Preud'homme <thomas.preudhomme@arm.com> 2016-03-29 Thomas Preud'homme <thomas.preudhomme@arm.com>
* bfd-in.h (bfd_elf32_arm_set_target_relocs): Add a new parameter for * bfd-in.h (bfd_elf32_arm_set_target_relocs): Add a new parameter for
......
...@@ -4076,6 +4076,7 @@ elf32_arm_get_stub_entry (const asection *input_section, ...@@ -4076,6 +4076,7 @@ elf32_arm_get_stub_entry (const asection *input_section,
Stub names need to include a section id, as there may well be Stub names need to include a section id, as there may well be
more than one stub used to reach say, printf, and we need to more than one stub used to reach say, printf, and we need to
distinguish between them. */ distinguish between them. */
BFD_ASSERT (input_section->id <= htab->top_id);
id_sec = htab->stub_group[input_section->id].link_sec; id_sec = htab->stub_group[input_section->id].link_sec;
   
if (h != NULL && h->stub_cache != NULL if (h != NULL && h->stub_cache != NULL
...@@ -4233,6 +4234,7 @@ elf32_arm_create_or_find_stub_sec (asection **link_sec_p, asection *section, ...@@ -4233,6 +4234,7 @@ elf32_arm_create_or_find_stub_sec (asection **link_sec_p, asection *section,
} }
else else
{ {
BFD_ASSERT (section->id <= htab->top_id);
link_sec = htab->stub_group[section->id].link_sec; link_sec = htab->stub_group[section->id].link_sec;
BFD_ASSERT (link_sec != NULL); BFD_ASSERT (link_sec != NULL);
stub_sec_p = &htab->stub_group[section->id].stub_sec; stub_sec_p = &htab->stub_group[section->id].stub_sec;
...@@ -5342,6 +5344,7 @@ elf32_arm_create_stub (struct elf32_arm_link_hash_table *htab, ...@@ -5342,6 +5344,7 @@ elf32_arm_create_stub (struct elf32_arm_link_hash_table *htab,
{ {
BFD_ASSERT (irela); BFD_ASSERT (irela);
BFD_ASSERT (section); BFD_ASSERT (section);
BFD_ASSERT (section->id <= htab->top_id);
   
/* Support for grouping stub sections. */ /* Support for grouping stub sections. */
id_sec = htab->stub_group[section->id].link_sec; id_sec = htab->stub_group[section->id].link_sec;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment