aboutsummaryrefslogtreecommitdiff
path: root/bfd/peXXigen.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2005-07-29 14:07:01 +0000
committerNick Clifton <nickc@redhat.com>2005-07-29 14:07:01 +0000
commit0facbdf5c2ef772b4c43b7041b72e32c8210eab9 (patch)
treeab020d5a66bfa672825dd3c08632a31b453ec486 /bfd/peXXigen.c
parent0a7b9ba6058643f22eec1d04d981efdb1c78b12b (diff)
downloadgdb-0facbdf5c2ef772b4c43b7041b72e32c8210eab9.zip
gdb-0facbdf5c2ef772b4c43b7041b72e32c8210eab9.tar.gz
gdb-0facbdf5c2ef772b4c43b7041b72e32c8210eab9.tar.bz2
* peXXigen.c (pe_print_edata): Compute the size of the export table from the
size field in the DataDictionary and not the size of the section. Some linkers embed the export table inside a larger section.
Diffstat (limited to 'bfd/peXXigen.c')
-rw-r--r--bfd/peXXigen.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index 1be0846..652e45c 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -1346,6 +1346,7 @@ pe_print_edata (bfd * abfd, void * vfile)
return TRUE;
addr = section->vma;
+ dataoff = 0;
datasize = section->size;
if (datasize == 0)
return TRUE;
@@ -1355,12 +1356,8 @@ pe_print_edata (bfd * abfd, void * vfile)
addr += extra->ImageBase;
for (section = abfd->sections; section != NULL; section = section->next)
- {
- datasize = section->size;
-
- if (addr >= section->vma && addr < section->vma + datasize)
- break;
- }
+ if (addr >= section->vma && addr < section->vma + section->size)
+ break;
if (section == NULL)
{
@@ -1368,14 +1365,21 @@ pe_print_edata (bfd * abfd, void * vfile)
_("\nThere is an export table, but the section containing it could not be found\n"));
return TRUE;
}
+
+ dataoff = addr - section->vma;
+ datasize = extra->DataDirectory[0].Size;
+ if (datasize > section->size - dataoff)
+ {
+ fprintf (file,
+ _("\nThere is an export table in %s, but it does not fit into that section\n"),
+ section->name);
+ return TRUE;
+ }
}
fprintf (file, _("\nThere is an export table in %s at 0x%lx\n"),
section->name, (unsigned long) addr);
- dataoff = addr - section->vma;
- datasize -= dataoff;
-
data = bfd_malloc (datasize);
if (data == NULL)
return FALSE;