From: Alan Modra Date: Sat, 3 Jun 2023 03:09:06 +0000 (+0930) Subject: Re: More ecoff sanity checks X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c6e6e3ab2b70458d34c4a7a2e7e1637d38d49e8f;p=binutils-gdb.git Re: More ecoff sanity checks Yet another fuzzer fix. * ecoff.c (ecoff_slurp_symbolic_header ): Zero counts when associated pointer is zero. (_bfd_ecoff_slurp_symbolic_info): Remove now unnecessary check. --- 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; } +#define FIX(start, count) \ + if (internal_symhdr->start == 0) \ + internal_symhdr->count = 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 = internal_symhdr->isymMax + internal_symhdr->iextMax; @@ -580,7 +597,7 @@ _bfd_ecoff_slurp_symbolic_info (bfd *abfd, /* Get pointers for the numeric offsets in the HDRR structure. */ #define FIX(start, count, ptr, type) \ - if (internal_symhdr->start == 0 || internal_symhdr->count == 0) \ + if (internal_symhdr->count == 0) \ debug->ptr = NULL; \ else \ debug->ptr = (type) ((char *) raw \