File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -285,12 +285,11 @@ _bfd_elf_strtab_offset (struct elf_strtab_hash *tab, size_t idx)
285285{
286286 struct elf_strtab_hash_entry * entry ;
287287
288- if (idx == 0 )
288+ if (idx == 0 || idx >= tab -> size || tab -> sec_size == 0 )
289289 return 0 ;
290- BFD_ASSERT (idx < tab -> size );
291- BFD_ASSERT (tab -> sec_size );
292290 entry = tab -> array [idx ];
293- BFD_ASSERT (entry -> refcount > 0 );
291+ if (entry == NULL || entry -> refcount == 0 )
292+ return 0 ;
294293 entry -> refcount -- ;
295294 return tab -> array [idx ]-> u .index ;
296295}
Original file line number Diff line number Diff line change @@ -7161,9 +7161,12 @@ _bfd_elf_write_object_contents (bfd *abfd)
71617161 {
71627162 /* Don't set the sh_name field without section header. */
71637163 if ((abfd -> flags & BFD_NO_SECTION_HEADER ) == 0 )
7164- i_shdrp [count ]-> sh_name
7165- = _bfd_elf_strtab_offset (elf_shstrtab (abfd ),
7166- i_shdrp [count ]-> sh_name );
7164+ {
7165+ i_shdrp [count ]-> sh_name
7166+ = _bfd_elf_strtab_offset (elf_shstrtab (abfd ),
7167+ i_shdrp [count ]-> sh_name );
7168+ /* FIXME: If we could not set the section name, should we tell the user ? */
7169+ }
71677170 if (bed -> elf_backend_section_processing )
71687171 if (!(* bed -> elf_backend_section_processing ) (abfd , i_shdrp [count ]))
71697172 return false;
You can’t perform that action at this time.
0 commit comments