From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1062) id AF9003858404; Thu, 4 Apr 2024 02:51:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AF9003858404 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1712199105; bh=20CGWYFmXNBLt5Z7x2K2hKGDwjLIikA+I5REM5VREAs=; h=From:To:Subject:Date:From; b=Z/09lNJBlA8RVdDKNFe4Qg0dl3gizwQvWfbtjuHqSAgGX6je1QWEqxEvK9InhnmjP gg/Md125uGIcF7SiZP/OKxCErUpkw8ocVbpOpFqq4etuQvIFfGGCkI1MuFkcwHpCrn fvshatPGXhpaCohtVOo2ynjijpm8NMfshy76fu78= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Alan Modra To: binutils-cvs@sourceware.org Subject: [binutils-gdb] Re: USE_MMAP fuzzed object file attacks X-Act-Checkin: binutils-gdb X-Git-Author: Alan Modra X-Git-Refname: refs/heads/master X-Git-Oldrev: 9fd82d9142d742c9e3efb16466019bd5fe86aef9 X-Git-Newrev: 0ab0435fe672b76f0efb8814594b65c8e968d983 Message-Id: <20240404025145.AF9003858404@sourceware.org> Date: Thu, 4 Apr 2024 02:51:45 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D0ab0435fe672= b76f0efb8814594b65c8e968d983 commit 0ab0435fe672b76f0efb8814594b65c8e968d983 Author: Alan Modra Date: Thu Apr 4 12:50:17 2024 +1030 Re: USE_MMAP fuzzed object file attacks =20 I committed a broken patch. =20 * aoutx.h (aout_get_external_symbols): Remove wrong #else and unneeded casts. * pdp11.c (aout_get_external_symbols): Likewise. Diff: --- bfd/aoutx.h | 7 +++---- bfd/pdp11.c | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/bfd/aoutx.h b/bfd/aoutx.h index fb6326d79d1..d98ba61a339 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -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 =3D (struct external_nlist *) obj_aout_sym_window (abfd).data; + syms =3D 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) !=3D 0) return false; - syms =3D (struct external_nlist *) _bfd_malloc_and_read (abfd, amt, amt= ); + syms =3D _bfd_malloc_and_read (abfd, amt, amt); if (syms =3D=3D NULL) return false; } -#endif =20 obj_aout_external_syms (abfd) =3D syms; obj_aout_external_sym_count (abfd) =3D count; diff --git a/bfd/pdp11.c b/bfd/pdp11.c index f9ded64c933..b20c39659db 100644 --- a/bfd/pdp11.c +++ b/bfd/pdp11.c @@ -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 =3D (struct external_nlist *) obj_aout_sym_window (abfd).data; + syms =3D 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) !=3D 0) return false; - syms =3D (struct external_nlist *) _bfd_malloc_and_read (abfd, amt, amt= ); + syms =3D _bfd_malloc_and_read (abfd, amt, amt); if (syms =3D=3D NULL) return false; } -#endif =20 obj_aout_external_syms (abfd) =3D syms; obj_aout_external_sym_count (abfd) =3D count;