Avoid ubsan complaint in BFD
I built gdb with ubsan and ran the test suite. One complaint was due to bfd_get_elf_phdrs passing NULL to memcpy. This patch avoids the complaint. bfd/ChangeLog 2018-07-23 Tom Tromey <tom@tromey.com> * elf.c (bfd_get_elf_phdrs): Don't call memcpy with size 0.
This commit is contained in:
parent
e2b7fbc46d
commit
01bcaf636a
2 changed files with 7 additions and 2 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2018-07-23 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
|
* elf.c (bfd_get_elf_phdrs): Don't call memcpy with size 0.
|
||||||
|
|
||||||
2018-07-21 Eric Botcazou <ebotcazou@adacore.com>
|
2018-07-21 Eric Botcazou <ebotcazou@adacore.com>
|
||||||
|
|
||||||
* elf32-arm.c (elf32_arm_final_link_relocate) <R_ARM_GOT32>: Small
|
* elf32-arm.c (elf32_arm_final_link_relocate) <R_ARM_GOT32>: Small
|
||||||
|
|
|
@ -11629,6 +11629,7 @@ bfd_get_elf_phdrs (bfd *abfd, void *phdrs)
|
||||||
}
|
}
|
||||||
|
|
||||||
num_phdrs = elf_elfheader (abfd)->e_phnum;
|
num_phdrs = elf_elfheader (abfd)->e_phnum;
|
||||||
|
if (num_phdrs != 0)
|
||||||
memcpy (phdrs, elf_tdata (abfd)->phdr,
|
memcpy (phdrs, elf_tdata (abfd)->phdr,
|
||||||
num_phdrs * sizeof (Elf_Internal_Phdr));
|
num_phdrs * sizeof (Elf_Internal_Phdr));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue