diff options
author | Alan Modra <amodra@gmail.com> | 2019-12-18 23:03:28 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2019-12-18 23:04:35 +1030 |
commit | 599956cfe164ca2f4f7d04b90aee1db98930a023 (patch) | |
tree | c9c65428a37fe3dd85407996d1a9679d9d54d020 | |
parent | 2365f8d70c50afbfd6be69a4076ea6e78fb5485d (diff) | |
download | gdb-599956cfe164ca2f4f7d04b90aee1db98930a023.zip gdb-599956cfe164ca2f4f7d04b90aee1db98930a023.tar.gz gdb-599956cfe164ca2f4f7d04b90aee1db98930a023.tar.bz2 |
ld signed overflow fix
* pe-dll.c (pe_get32, pe_as32): Avoid signed overflow.
-rw-r--r-- | ld/ChangeLog | 4 | ||||
-rw-r--r-- | ld/pe-dll.c | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 417bb15..7c36a5d 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -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. diff --git a/ld/pe-dll.c b/ld/pe-dll.c index 4679fca..7f45546 100644 --- a/ld/pe-dll.c +++ b/ld/pe-dll.c @@ -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 |