ld signed overflow fix

* pe-dll.c (pe_get32, pe_as32): Avoid signed overflow.
This commit is contained in:
Alan Modra 2019-12-18 23:03:28 +10:30
parent 2365f8d70c
commit 599956cfe1
2 changed files with 6 additions and 2 deletions

View file

@ -1,3 +1,7 @@
2019-12-18 Alan Modra <amodra@gmail.com>
* pe-dll.c (pe_get32, pe_as32): Avoid signed overflow.
2019-12-17 Alan Modra <amodra@gmail.com>
* testsuite/ld-avr/lds-mega.d: Adjust symbols to suit objdump change.

View file

@ -3289,7 +3289,7 @@ pe_get32 (bfd *abfd, int where)
bfd_seek (abfd, (file_ptr) where, SEEK_SET);
bfd_bread (b, (bfd_size_type) 4, abfd);
return b[0] + (b[1] << 8) + (b[2] << 16) + (b[3] << 24);
return b[0] + (b[1] << 8) + (b[2] << 16) + ((unsigned) b[3] << 24);
}
static unsigned int
@ -3297,7 +3297,7 @@ pe_as32 (void *ptr)
{
unsigned char *b = ptr;
return b[0] + (b[1] << 8) + (b[2] << 16) + (b[3] << 24);
return b[0] + (b[1] << 8) + (b[2] << 16) + ((unsigned) b[3] << 24);
}
bfd_boolean