Fix illegal memory access parsing an unexpected win32pstatus note.

Nick Clifton nickc@redhat.com
Thu Jan 14 09:14:58 GMT 2021


Hi Guys,

  I am applying the patch below (to the mainline and the 2.36 branch) in
  order to fix this bug reported on the Fedora system:

    https://bugzilla.redhat.com/show_bug.cgi?id=1916110

Cheers
  Nick

bfd/ChangeLog
2021-01-14  Nick Clifton  <nickc@redhat.com>

	* elf.c (elfcore_grok_win32pstatus): Check for a note type of 0.

diff --git a/bfd/elf.c b/bfd/elf.c
index ab19bdb453..84a5d94281 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -10174,7 +10175,7 @@ elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note)
        { "NOTE_INFO_MODULE64", 16 },
       };
 
-  if (type > (sizeof(size_check)/sizeof(size_check[0])))
+  if (type == 0 || type > (sizeof(size_check)/sizeof(size_check[0])))
       return TRUE;
 
   if (note->descsz < size_check[type - 1].min_size)



More information about the Binutils mailing list