summaryrefslogtreecommitdiff
path: root/bfd/peXXigen.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-06-17 13:39:56 +0000
committerJakub Jelinek <jakub@redhat.com>2005-06-17 13:39:56 +0000
commit7916b653e5f97d7e271baabe5a7f142777e9d592 (patch)
tree1a9c5a50e939763de4ee904c17fe6bd690e37379 /bfd/peXXigen.c
parentc36ab55f1ce9c8368447e8650e695d9f115cc998 (diff)
downloadbinutils-redhat-7916b653e5f97d7e271baabe5a7f142777e9d592.tar.gz
* elf.c (bfd_section_from_shdr): Fail if sh_entsize is bogus for
symbol, relocation, group or versym sections. * coffcode.h (coff_slurp_reloc_table): Don't crash if native_relocs is NULL. * peXXigen.c (pe_print_idata): Don't crash if dll_name or start_address doesn't point into the section.
Diffstat (limited to 'bfd/peXXigen.c')
-rw-r--r--bfd/peXXigen.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index 6597312adb..1be08466b2 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -1103,7 +1103,7 @@ pe_print_idata (bfd * abfd, void * vfile)
bfd_vma toc_address;
bfd_vma start_address;
bfd_byte *data;
- int offset;
+ bfd_vma offset;
if (!bfd_malloc_and_get_section (abfd, rel_section, &data))
{
@@ -1114,6 +1114,13 @@ pe_print_idata (bfd * abfd, void * vfile)
offset = abfd->start_address - rel_section->vma;
+ if (offset >= rel_section->size || offset + 8 > rel_section->size)
+ {
+ if (data != NULL)
+ free (data);
+ return FALSE;
+ }
+
start_address = bfd_get_32 (abfd, data + offset);
loadable_toc_address = bfd_get_32 (abfd, data + offset + 4);
toc_address = loadable_toc_address - 32768;
@@ -1182,6 +1189,9 @@ pe_print_idata (bfd * abfd, void * vfile)
if (hint_addr == 0 && first_thunk == 0)
break;
+ if (dll_name - adj >= section->size)
+ break;
+
dll = (char *) data + dll_name - adj;
fprintf (file, _("\n\tDLL Name: %s\n"), dll);