mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-20 18:08:24 +08:00
PR28166, _bfd_elf_mips_get_relocated_section_contents
Some of the code paths unpacking mips relocs left arelent->sym_ptr_ptr uninitialised. PR 28166 * elf64-mips.c (mips_elf64_slurp_one_reloc_table): Don't leave sym_ptr_ptr uninitialised.
This commit is contained in:
@ -4073,6 +4073,7 @@ mips_elf64_slurp_one_reloc_table (bfd *abfd, asection *asect,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Some types require symbols, whereas some do not. */
|
/* Some types require symbols, whereas some do not. */
|
||||||
|
relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case R_MIPS_NONE:
|
case R_MIPS_NONE:
|
||||||
@ -4080,14 +4081,13 @@ mips_elf64_slurp_one_reloc_table (bfd *abfd, asection *asect,
|
|||||||
case R_MIPS_INSERT_A:
|
case R_MIPS_INSERT_A:
|
||||||
case R_MIPS_INSERT_B:
|
case R_MIPS_INSERT_B:
|
||||||
case R_MIPS_DELETE:
|
case R_MIPS_DELETE:
|
||||||
relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (! used_sym)
|
if (! used_sym)
|
||||||
{
|
{
|
||||||
if (rela.r_sym == STN_UNDEF)
|
if (rela.r_sym == STN_UNDEF)
|
||||||
relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
|
;
|
||||||
else if (rela.r_sym > symcount)
|
else if (rela.r_sym > symcount)
|
||||||
{
|
{
|
||||||
_bfd_error_handler
|
_bfd_error_handler
|
||||||
@ -4096,8 +4096,6 @@ mips_elf64_slurp_one_reloc_table (bfd *abfd, asection *asect,
|
|||||||
" has invalid symbol index %ld"),
|
" has invalid symbol index %ld"),
|
||||||
abfd, asect, (uint64_t) i, rela.r_sym);
|
abfd, asect, (uint64_t) i, rela.r_sym);
|
||||||
bfd_set_error (bfd_error_bad_value);
|
bfd_set_error (bfd_error_bad_value);
|
||||||
relent->sym_ptr_ptr
|
|
||||||
= bfd_abs_section_ptr->symbol_ptr_ptr;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -4118,8 +4116,6 @@ mips_elf64_slurp_one_reloc_table (bfd *abfd, asection *asect,
|
|||||||
switch (rela.r_ssym)
|
switch (rela.r_ssym)
|
||||||
{
|
{
|
||||||
case RSS_UNDEF:
|
case RSS_UNDEF:
|
||||||
relent->sym_ptr_ptr =
|
|
||||||
bfd_abs_section_ptr->symbol_ptr_ptr;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RSS_GP:
|
case RSS_GP:
|
||||||
@ -4137,9 +4133,6 @@ mips_elf64_slurp_one_reloc_table (bfd *abfd, asection *asect,
|
|||||||
|
|
||||||
used_ssym = true;
|
used_ssym = true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user