aboutsummaryrefslogtreecommitdiff
path: root/bfd/mach-o.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2021-04-30 14:31:03 +0100
committerNick Clifton <nickc@redhat.com>2021-04-30 14:31:03 +0100
commitd1fbc3ba09fb2e79acf633df29ccbe9285624419 (patch)
tree0edbf62a9288e98c418fa70d4ca51fa047aec9f5 /bfd/mach-o.c
parent9f84cb380e8403ad4f1184fd09af475c17fd8835 (diff)
downloadgdb-d1fbc3ba09fb2e79acf633df29ccbe9285624419.zip
gdb-d1fbc3ba09fb2e79acf633df29ccbe9285624419.tar.gz
gdb-d1fbc3ba09fb2e79acf633df29ccbe9285624419.tar.bz2
Fix illegal memory access parsing a corrupt MACH-O format file.
PR 27801 * mach-o.c (bfd_mach_o_core_fetch_environment): Use bfd_get_32 to read 32-bit value.
Diffstat (limited to 'bfd/mach-o.c')
-rw-r--r--bfd/mach-o.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/bfd/mach-o.c b/bfd/mach-o.c
index 60121c4..ff18ded 100644
--- a/bfd/mach-o.c
+++ b/bfd/mach-o.c
@@ -5931,7 +5931,8 @@ bfd_mach_o_core_fetch_environment (bfd *abfd,
{
unsigned long val;
- val = *((unsigned long *) (buf + size - offset));
+ val = bfd_get_32(abfd, buf + size - offset);
+
if (! found_nonnull)
{
if (val != 0)