From: Nick Clifton Date: Fri, 30 Apr 2021 13:31:03 +0000 (+0100) Subject: Fix illegal memory access parsing a corrupt MACH-O format file. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d1fbc3ba09fb2e79acf633df29ccbe9285624419;p=binutils-gdb.git 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. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index cd9b1b38607..c5a617cef97 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2021-04-30 Nick Clifton + + PR 27801 + * mach-o.c (bfd_mach_o_core_fetch_environment): Use bfd_get_32 to + read 32-bit value. + 2021-04-30 Nick Clifton PR 27799 diff --git a/bfd/mach-o.c b/bfd/mach-o.c index 60121c4ef47..ff18ded23d5 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)