https://sourceware.org/bugzilla/show_bug.cgi?id=34339

--- Comment #2 from Zheng Bao <fishbaoz at hotmail dot com> ---
(In reply to Zheng Bao from comment #1)
> https://sourceware.org/git?p=binutils-gdb.git;a=blob;f=binutils/readelf.c;
> h=bf94f4d5caa6d9682fcbb8042f06b8fe08c39815;hb=HEAD#l1829
> 
> In the function update_all_relocations, the global all_relocations is not
> initialized.
> 
> 1829 static void
> 1830 update_all_relocations (size_t nentries)
> 1831 {
> 1832   size_t sz;
> 1833 
> 1834   if (!do_got_section_contents)
> 1835     return;
> 1836 
> 1837   if (!all_relocations_root)
> 1838     {
> 1839       sz = nentries * sizeof (elf_relocation);
> 1840       all_relocations_root = xmalloc (sz);
> 1841       all_relocations = all_relocations_root;
> 1842       all_relocations_count = nentries;
> 1843     }
> 1844   else
> 1845     {
> 1846       size_t orig_count = all_relocations_count;
> 1847       sz = (orig_count + nentries) * sizeof (elf_relocation);
> 1848       all_relocations_root = xrealloc (all_relocations_root, sz);
> 1849       all_relocations = all_relocations_root + orig_count;
> 1850       all_relocations_count += nentries;
> 1851     }
> 1852   memset (all_relocations, 0, nentries * sizeof (elf_relocation));
> 1853 }
> 
> 
> https://sourceware.org/git?p=binutils-gdb.git;a=blob;f=binutils/readelf.c;
> h=bf94f4d5caa6d9682fcbb8042f06b8fe08c39815;hb=HEAD#l2177
> 
> But in function dump_relr_relocations, it is accessed.
> 2177           if (do_got_section_contents)
> 2178             {
> 2179               all_relocations[r].r_offset = where;
> 2180               all_relocations[r].r_name = rtype;
> 2181               all_relocations[r].r_symbol = NULL;
> 2182               all_relocations[r].r_type = reltype_relr;
> 2183               r++;
> 2184             }
> 2185

update_all_relocations is even called.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to