diff options
author | Alan Modra <amodra@gmail.com> | 2019-07-08 10:06:09 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2019-07-08 15:26:33 +0930 |
commit | 62a47958bd6e3cbd909c2f19cd4669a9670ce4f1 (patch) | |
tree | 588e403369eedac6e237aa9ab8007a58dd5c65bc /bfd/elf32-ppc.c | |
parent | 3836e1d1ab859b9f6c41bc4565ef779640b7c706 (diff) | |
download | gdb-62a47958bd6e3cbd909c2f19cd4669a9670ce4f1.zip gdb-62a47958bd6e3cbd909c2f19cd4669a9670ce4f1.tar.gz gdb-62a47958bd6e3cbd909c2f19cd4669a9670ce4f1.tar.bz2 |
PR24785, bfd crashes on empty .PPC.EMB.apuinfo section
PR 24785
* elf32-ppc.c (_bfd_elf_ppc_set_arch): Sanity check .PPC.EMB.apuinfo
size before reading first word.
Diffstat (limited to 'bfd/elf32-ppc.c')
-rw-r--r-- | bfd/elf32-ppc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index df813d3..ae03d72 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -1077,7 +1077,9 @@ _bfd_elf_ppc_set_arch (bfd *abfd) if (mach == 0) { s = bfd_get_section_by_name (abfd, APUINFO_SECTION_NAME); - if (s != NULL && bfd_malloc_and_get_section (abfd, s, &contents)) + if (s != NULL + && s->size >= 24 + && bfd_malloc_and_get_section (abfd, s, &contents)) { unsigned int apuinfo_size = bfd_get_32 (abfd, contents + 4); unsigned int i; |