aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2023-06-03 12:39:06 +0930
committerAlan Modra <amodra@gmail.com>2023-06-03 17:17:37 +0930
commitc6e6e3ab2b70458d34c4a7a2e7e1637d38d49e8f (patch)
tree41b2248c9a5b6b2d2be6f4f9a975565f9597e05e
parent26cc2053e2e8a5392a08b21fc62a2cffd900f13f (diff)
downloadgdb-c6e6e3ab2b70458d34c4a7a2e7e1637d38d49e8f.zip
gdb-c6e6e3ab2b70458d34c4a7a2e7e1637d38d49e8f.tar.gz
gdb-c6e6e3ab2b70458d34c4a7a2e7e1637d38d49e8f.tar.bz2
Re: More ecoff sanity checks
Yet another fuzzer fix. * ecoff.c (ecoff_slurp_symbolic_header <FIX>): Zero counts when associated pointer is zero. (_bfd_ecoff_slurp_symbolic_info): Remove now unnecessary check.
-rw-r--r--bfd/ecoff.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/bfd/ecoff.c b/bfd/ecoff.c
index f293056..c4c2e53 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 \