From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1062) id 3F5A93857341; Sat, 3 Jun 2023 08:06:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3F5A93857341 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Alan Modra To: bfd-cvs@sourceware.org Subject: [binutils-gdb] Re: More ecoff sanity checks X-Act-Checkin: binutils-gdb X-Git-Author: Alan Modra X-Git-Refname: refs/heads/master X-Git-Oldrev: 26cc2053e2e8a5392a08b21fc62a2cffd900f13f X-Git-Newrev: c6e6e3ab2b70458d34c4a7a2e7e1637d38d49e8f Message-Id: <20230603080630.3F5A93857341@sourceware.org> Date: Sat, 3 Jun 2023 08:06:30 +0000 (GMT) X-BeenThere: binutils-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Jun 2023 08:06:30 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dc6e6e3ab2b70= 458d34c4a7a2e7e1637d38d49e8f commit c6e6e3ab2b70458d34c4a7a2e7e1637d38d49e8f Author: Alan Modra Date: Sat Jun 3 12:39:06 2023 +0930 Re: More ecoff sanity checks =20 Yet another fuzzer fix. =20 * ecoff.c (ecoff_slurp_symbolic_header ): Zero counts when associated pointer is zero. (_bfd_ecoff_slurp_symbolic_info): Remove now unnecessary check. Diff: --- bfd/ecoff.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/bfd/ecoff.c b/bfd/ecoff.c index f2930569f21..c4c2e530be0 100644 --- a/bfd/ecoff.c +++ b/bfd/ecoff.c @@ -468,6 +468,23 @@ ecoff_slurp_symbolic_header (bfd *abfd) goto error_return; } =20 +#define FIX(start, count) \ + if (internal_symhdr->start =3D=3D 0) \ + internal_symhdr->count =3D 0; + + FIX (cbLineOffset, cbLine); + FIX (cbDnOffset, idnMax); + FIX (cbPdOffset, ipdMax); + FIX (cbSymOffset, isymMax); + FIX (cbOptOffset, ioptMax); + FIX (cbAuxOffset, iauxMax); + FIX (cbSsOffset, issMax); + FIX (cbSsExtOffset, issExtMax); + FIX (cbFdOffset, ifdMax); + FIX (cbRfdOffset, crfd); + FIX (cbExtOffset, iextMax); +#undef FIX + /* Now we can get the correct number of symbols. */ abfd->symcount =3D internal_symhdr->isymMax + internal_symhdr->iextMax; =20 @@ -580,7 +597,7 @@ _bfd_ecoff_slurp_symbolic_info (bfd *abfd, =20 /* Get pointers for the numeric offsets in the HDRR structure. */ #define FIX(start, count, ptr, type) \ - if (internal_symhdr->start =3D=3D 0 || internal_symhdr->count =3D=3D 0) \ + if (internal_symhdr->count =3D=3D 0) \ debug->ptr =3D NULL; \ else \ debug->ptr =3D (type) ((char *) raw \