From d1fbc3ba09fb2e79acf633df29ccbe9285624419 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Fri, 30 Apr 2021 14:31:03 +0100 Subject: 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. --- bfd/ChangeLog | 6 ++++++ bfd/mach-o.c | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'bfd') diff --git a/bfd/ChangeLog b/bfd/ChangeLog index cd9b1b3..c5a617c 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,11 @@ 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 * elf32-xtensa.c (elf_xtensa_grok_prstatus): Check for core notes that are too small. 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) -- cgit v1.1