diff options
author | Alan Modra <amodra@gmail.com> | 2020-08-26 18:32:30 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2020-08-26 23:23:45 +0930 |
commit | 00bc5e68b2c02fd2b1daacc37850840498595fb0 (patch) | |
tree | 3fbc77ab2566e9bd43dd0d38384330dbf8c4a5e1 /bfd/mmo.c | |
parent | 55e61b8ad977cba772753c8dbba5c81f6b1fa54c (diff) | |
download | gdb-00bc5e68b2c02fd2b1daacc37850840498595fb0.zip gdb-00bc5e68b2c02fd2b1daacc37850840498595fb0.tar.gz gdb-00bc5e68b2c02fd2b1daacc37850840498595fb0.tar.bz2 |
PR26478 UBSAN: mmo.c:2941 null pointer memcpy
PR 26478
* mmo.c (mmo_write_symbols_and_terminator): Don't memcpy empty table.
Diffstat (limited to 'bfd/mmo.c')
-rw-r--r-- | bfd/mmo.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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 |