diff options
-rw-r--r-- | bfd/ChangeLog | 5 | ||||
-rw-r--r-- | bfd/peXXigen.c | 14 |
2 files changed, 7 insertions, 12 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index ab665ed..9fcc6fc 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,10 @@ 2018-10-16 Alan Modra <amodra@gmail.com> + * peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Simplify + PE_DEBUG_DATA size checks. + +2018-10-16 Alan Modra <amodra@gmail.com> + PR 23781 * peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Free data before returning. diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c index 1271d4e..e0b494a 100644 --- a/bfd/peXXigen.c +++ b/bfd/peXXigen.c @@ -2984,8 +2984,8 @@ _bfd_XX_bfd_copy_private_bfd_data_common (bfd * ibfd, bfd * obfd) (struct external_IMAGE_DEBUG_DIRECTORY *)(data + (addr - section->vma)); /* PR 17512: file: 0f15796a. */ - if (ope->pe_opthdr.DataDirectory[PE_DEBUG_DATA].Size + (addr - section->vma) - > bfd_get_section_size (section)) + if ((unsigned long) ope->pe_opthdr.DataDirectory[PE_DEBUG_DATA].Size + > section->size - (addr - section->vma)) { /* xgettext:c-format */ _bfd_error_handler @@ -2996,16 +2996,6 @@ _bfd_XX_bfd_copy_private_bfd_data_common (bfd * ibfd, bfd * obfd) free (data); return FALSE; } - /* PR 23110. */ - else if (ope->pe_opthdr.DataDirectory[PE_DEBUG_DATA].Size < 0) - { - /* xgettext:c-format */ - _bfd_error_handler - (_("%pB: Data Directory size (%#lx) is negative"), - obfd, ope->pe_opthdr.DataDirectory[PE_DEBUG_DATA].Size); - free (data); - return FALSE; - } for (i = 0; i < ope->pe_opthdr.DataDirectory[PE_DEBUG_DATA].Size / sizeof (struct external_IMAGE_DEBUG_DIRECTORY); i++) |