[binutils-gdb] asan: som: unknown read

Alan Modra amodra@sourceware.org
Wed Mar 11 12:33:03 GMT 2020


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8248d21a5b8b7bb9970163b8b327f5ac2f857f33

commit 8248d21a5b8b7bb9970163b8b327f5ac2f857f33
Author: Alan Modra <amodra@gmail.com>
Date:   Wed Mar 11 22:59:07 2020 +1030

    asan: som: unknown read
    
            * som.c (setup_sections): Sanity check subspace.name.

Diff:
---
 bfd/ChangeLog | 4 ++++
 bfd/som.c     | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index c60fe8c7f93..3b252e11968 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,7 @@
+2020-03-11  Alan Modra  <amodra@gmail.com>
+
+	* som.c (setup_sections): Sanity check subspace.name.
+
 2020-03-11  Alan Modra  <amodra@gmail.com>
 
 	* elf64-ppc.c (ppc64_elf_inline_plt): Do increment rel in for loop.
diff --git a/bfd/som.c b/bfd/som.c
index 3aa3d60b02b..5676f0f5008 100644
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -2197,6 +2197,9 @@ setup_sections (bfd *abfd,
 	  som_swap_subspace_dictionary_in (&ext_subspace, &subspace);
 
 	  /* Setup the subspace name string.  */
+	  if (subspace.name >= file_hdr->space_strings_size)
+	    goto error_return;
+
 	  subspace_name = subspace.name + space_strings;
 
 	  amt = strlen (subspace_name) + 1;


More information about the Binutils-cvs mailing list