asan: som: unknown read
authorAlan Modra <amodra@gmail.com>
Wed, 11 Mar 2020 12:29:07 +0000 (22:59 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 11 Mar 2020 12:32:51 +0000 (23:02 +1030)
* som.c (setup_sections): Sanity check subspace.name.

bfd/ChangeLog
bfd/som.c

index c60fe8c7f9320284089e6033debb96161c79be90..3b252e1196830c44cfbf8b0eda7c8f64eb3d5bd7 100644 (file)
@@ -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.
index 3aa3d60b02bcd61372a61695f77fe01b27d85969..5676f0f5008081ad24f94a05a525a5f68bdf6e3b 100644 (file)
--- 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;