aboutsummaryrefslogtreecommitdiff
path: root/ld/pe-dll.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-12-18 23:03:28 +1030
committerAlan Modra <amodra@gmail.com>2019-12-18 23:04:35 +1030
commit599956cfe164ca2f4f7d04b90aee1db98930a023 (patch)
treec9c65428a37fe3dd85407996d1a9679d9d54d020 /ld/pe-dll.c
parent2365f8d70c50afbfd6be69a4076ea6e78fb5485d (diff)
downloadgdb-599956cfe164ca2f4f7d04b90aee1db98930a023.zip
gdb-599956cfe164ca2f4f7d04b90aee1db98930a023.tar.gz
gdb-599956cfe164ca2f4f7d04b90aee1db98930a023.tar.bz2
ld signed overflow fix
* pe-dll.c (pe_get32, pe_as32): Avoid signed overflow.
Diffstat (limited to 'ld/pe-dll.c')
-rw-r--r--ld/pe-dll.c4
1 files changed, 2 insertions, 2 deletions
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