diff options
author | Alan Modra <amodra@gmail.com> | 2020-08-25 14:51:21 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2020-08-25 23:07:10 +0930 |
commit | 30b940a097d48c73013bea38a36c5f8e3c3b2358 (patch) | |
tree | 563f37c40afa201fec998c4d7709f3a858ba748f /gas/symbols.c | |
parent | ca159256b4eb2c3bf245aef7f05a24fcc1ca6d9b (diff) | |
download | gdb-30b940a097d48c73013bea38a36c5f8e3c3b2358.zip gdb-30b940a097d48c73013bea38a36c5f8e3c3b2358.tar.gz gdb-30b940a097d48c73013bea38a36c5f8e3c3b2358.tar.bz2 |
PR26410, UBSAN: symbols.c:1818
Don't memset(0,0,0).
PR 26410
* symbols.c (dollar_label_count, dollar_label_max): Make size_t.
(dollar_label_clear): Don't call memset with NULL pointer.
Diffstat (limited to 'gas/symbols.c')
-rw-r--r-- | gas/symbols.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gas/symbols.c b/gas/symbols.c index 04017b6..67ac801 100644 --- a/gas/symbols.c +++ b/gas/symbols.c @@ -1761,8 +1761,8 @@ snapshot_symbol (symbolS **symbolPP, valueT *valueP, segT *segP, fragS **fragPP) static long *dollar_labels; static long *dollar_label_instances; static char *dollar_label_defines; -static unsigned long dollar_label_count; -static unsigned long dollar_label_max; +static size_t dollar_label_count; +static size_t dollar_label_max; int dollar_label_defined (long label) @@ -1798,7 +1798,8 @@ dollar_label_instance (long label) void dollar_label_clear (void) { - memset (dollar_label_defines, '\0', (unsigned int) dollar_label_count); + if (dollar_label_count) + memset (dollar_label_defines, '\0', dollar_label_count); } #define DOLLAR_LABEL_BUMP_BY 10 |