]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Re: USE_MMAP fuzzed object file attacks
authorAlan Modra <amodra@gmail.com>
Thu, 4 Apr 2024 02:20:17 +0000 (12:50 +1030)
committerAlan Modra <amodra@gmail.com>
Thu, 4 Apr 2024 02:49:42 +0000 (13:19 +1030)
I committed a broken patch.

* aoutx.h (aout_get_external_symbols): Remove wrong #else and
unneeded casts.
* pdp11.c (aout_get_external_symbols): Likewise.

bfd/aoutx.h
bfd/pdp11.c

index fb6326d79d1ffb2dc828c11cf7d3f62f27dc5a6f..d98ba61a3396f7a73182189bb62b28b01a6cef37 100644 (file)
@@ -1322,21 +1322,20 @@ aout_get_external_symbols (bfd *abfd)
          if (! bfd_get_file_window (abfd, obj_sym_filepos (abfd), amt,
                                     &obj_aout_sym_window (abfd), true))
            return false;
-         syms = (struct external_nlist *) obj_aout_sym_window (abfd).data;
+         syms = obj_aout_sym_window (abfd).data;
        }
       else
-#else
+#endif
        {
          /* We allocate using malloc to make the values easy to free
             later on.  If we put them on the objalloc it might not be
             possible to free them.  */
          if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0)
            return false;
-         syms = (struct external_nlist *) _bfd_malloc_and_read (abfd, amt, amt);
+         syms = _bfd_malloc_and_read (abfd, amt, amt);
          if (syms == NULL)
            return false;
        }
-#endif
 
       obj_aout_external_syms (abfd) = syms;
       obj_aout_external_sym_count (abfd) = count;
index f9ded64c9331737c3f4df580238357d9f5a435d4..b20c39659db8f4f28ea59dc7d87dc869fbd64682 100644 (file)
@@ -1299,21 +1299,20 @@ aout_get_external_symbols (bfd *abfd)
          if (! bfd_get_file_window (abfd, obj_sym_filepos (abfd), amt,
                                     &obj_aout_sym_window (abfd), true))
            return false;
-         syms = (struct external_nlist *) obj_aout_sym_window (abfd).data;
+         syms = obj_aout_sym_window (abfd).data;
        }
       else
-#else
+#endif
        {
          /* We allocate using malloc to make the values easy to free
             later on.  If we put them on the objalloc it might not be
             possible to free them.  */
          if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0)
            return false;
-         syms = (struct external_nlist *) _bfd_malloc_and_read (abfd, amt, amt);
+         syms = _bfd_malloc_and_read (abfd, amt, amt);
          if (syms == NULL)
            return false;
        }
-#endif
 
       obj_aout_external_syms (abfd) = syms;
       obj_aout_external_sym_count (abfd) = count;