PR26418 UBSAN: cache.c:386 null pointer fwrite

Alan Modra amodra@gmail.com
Fri Aug 28 12:28:38 GMT 2020


The previous "fix" tested the wrong value.

	PR 26418
	* ecofflink.c (WRITE): Really don't write zero size chunks.

diff --git a/bfd/ecofflink.c b/bfd/ecofflink.c
index 7c9a7aeaa0..e8c3f9f188 100644
--- a/bfd/ecofflink.c
+++ b/bfd/ecofflink.c
@@ -1491,7 +1491,7 @@ bfd_ecoff_write_debug (bfd *abfd,
 #define WRITE(ptr, count, size, offset) \
   BFD_ASSERT (symhdr->offset == 0				\
 	      || (bfd_vma) bfd_tell (abfd) == symhdr->offset);	\
-  if (size != 0							\
+  if (symhdr->count != 0					\
       && bfd_bwrite (debug->ptr,				\
 		     (bfd_size_type) size * symhdr->count,	\
 		     abfd) != size * symhdr->count)		\

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list