mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-22 11:00:01 +08:00
Simplify PR23110 PE_DEBUG_DATA size checks
The negative size check can be rolled into the "exceeds space left in section" check if that is done using an unsigned comparison. We know that "addr - section->vma" is never larger than section->size since the section is found by find_section_by_vma. * peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Simplify PE_DEBUG_DATA size checks.
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
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>
|
2018-10-16 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
PR 23781
|
PR 23781
|
||||||
|
@ -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));
|
(struct external_IMAGE_DEBUG_DIRECTORY *)(data + (addr - section->vma));
|
||||||
|
|
||||||
/* PR 17512: file: 0f15796a. */
|
/* PR 17512: file: 0f15796a. */
|
||||||
if (ope->pe_opthdr.DataDirectory[PE_DEBUG_DATA].Size + (addr - section->vma)
|
if ((unsigned long) ope->pe_opthdr.DataDirectory[PE_DEBUG_DATA].Size
|
||||||
> bfd_get_section_size (section))
|
> section->size - (addr - section->vma))
|
||||||
{
|
{
|
||||||
/* xgettext:c-format */
|
/* xgettext:c-format */
|
||||||
_bfd_error_handler
|
_bfd_error_handler
|
||||||
@ -2996,16 +2996,6 @@ _bfd_XX_bfd_copy_private_bfd_data_common (bfd * ibfd, bfd * obfd)
|
|||||||
free (data);
|
free (data);
|
||||||
return FALSE;
|
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
|
for (i = 0; i < ope->pe_opthdr.DataDirectory[PE_DEBUG_DATA].Size
|
||||||
/ sizeof (struct external_IMAGE_DEBUG_DIRECTORY); i++)
|
/ sizeof (struct external_IMAGE_DEBUG_DIRECTORY); i++)
|
||||||
|
Reference in New Issue
Block a user