* PR26478 UBSAN: mmo.c:2941 null pointer memcpy
@ 2020-08-26 13:49 Alan Modra
0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2020-08-26 13:49 UTC (permalink / raw)
To: binutils
PR 26478
* mmo.c (mmo_write_symbols_and_terminator): Don't memcpy empty table.
diff --git a/bfd/mmo.c b/bfd/mmo.c
index 5209736a50..92c51a4f63 100644
--- a/bfd/mmo.c
+++ b/bfd/mmo.c
@@ -2938,7 +2938,8 @@ mmo_write_symbols_and_terminator (bfd *abfd)
if (table == NULL)
return FALSE;
- memcpy (table, orig_table, count * sizeof (asymbol *));
+ if (count != 0)
+ memcpy (table, orig_table, count * sizeof (asymbol *));
/* Move :Main (if there is one) to the first position. This is
necessary to get the same layout of the trie-tree when linking as
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-08-26 13:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-26 13:49 PR26478 UBSAN: mmo.c:2941 null pointer memcpy Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).