Index: peXXigen.c =================================================================== RCS file: /cvs/src/src/bfd/peXXigen.c,v retrieving revision 1.64 diff -p -u -r1.64 peXXigen.c --- peXXigen.c 27 Jun 2010 04:07:53 -0000 1.64 +++ peXXigen.c 6 Sep 2010 11:16:00 -0000 @@ -1226,6 +1226,7 @@ pe_print_idata (bfd * abfd, void * vfile bfd_size_type ft_datasize; int ft_idx; int ft_allocated = 0; + bfd_size_type limit_size; fprintf (file, _("\tvma: Hint/Ord Member-Name Bound-To\n")); @@ -1234,6 +1235,7 @@ pe_print_idata (bfd * abfd, void * vfile ft_addr = first_thunk + extra->ImageBase; ft_data = data; ft_idx = first_thunk - adj; + limit_size = section->size - ft_idx; ft_allocated = 0; if (first_thunk != hint_addr) @@ -1262,17 +1264,19 @@ pe_print_idata (bfd * abfd, void * vfile { ft_data = data; ft_idx = first_thunk - adj; + limit_size = section->size - ft_idx; } else { ft_idx = first_thunk - (ft_section->vma - extra->ImageBase); - ft_data = (bfd_byte *) bfd_malloc (datasize); + limit_size = ft_section->size - ft_idx; + ft_data = (bfd_byte *) bfd_malloc (limit_size); if (ft_data == NULL) continue; - /* Read datasize bfd_bytes starting at offset ft_idx. */ + /* Read limit_size bfd_bytes starting at offset ft_idx. */ if (! bfd_get_section_contents - (abfd, ft_section, ft_data, (bfd_vma) ft_idx, datasize)) + (abfd, ft_section, ft_data, (bfd_vma) ft_idx, limit_size)) { free (ft_data); continue; @@ -1285,7 +1289,7 @@ pe_print_idata (bfd * abfd, void * vfile /* Print HintName vector entries. */ #ifdef COFF_WITH_pex64 - for (j = 0; j < datasize; j += 8) + for (j = 0; j < limit_size; j += 8) { unsigned long member = bfd_get_32 (abfd, data + idx + j); unsigned long member_high = bfd_get_32 (abfd, data + idx + j + 4); @@ -1316,7 +1320,7 @@ pe_print_idata (bfd * abfd, void * vfile fprintf (file, "\n"); } #else - for (j = 0; j < datasize; j += 4) + for (j = 0; j < limit_size; j += 4) { unsigned long member = bfd_get_32 (abfd, data + idx + j);