diff options
author | John Baldwin <jhb@FreeBSD.org> | 2018-11-09 11:44:20 -0800 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2018-11-09 11:44:20 -0800 |
commit | 9c122c7f9c8260d2cceb1e8f29d69607531f43ba (patch) | |
tree | 7cfc3723e505de7edd8fad4e1654086477fc3d55 /gdb/minsyms.c | |
parent | 4b905ae1b4d5f90e5737ee01ab4b7149be8c1fe5 (diff) | |
download | binutils-gdb-9c122c7f9c8260d2cceb1e8f29d69607531f43ba.tar.gz |
Fix unsigned overflow in minsyms reader.
Use a ssize_t helper variable for the number of bytes to shrink the
msymbols obstack rather than relying on unsigned overflow to shrink
the size of the obstack.
gdb/ChangeLog:
* minsyms.c (minimal_symbol_reader::install): Fix unsigned
overflow.
Diffstat (limited to 'gdb/minsyms.c')
-rw-r--r-- | gdb/minsyms.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gdb/minsyms.c b/gdb/minsyms.c index 4409e6f8b3a..0f854422e0f 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -1375,8 +1375,9 @@ minimal_symbol_reader::install () mcount = compact_minimal_symbols (msymbols, mcount, m_objfile); - obstack_blank_fast (&m_objfile->per_bfd->storage_obstack, - (mcount + 1 - alloc_count) * sizeof (struct minimal_symbol)); + ssize_t shrink_bytes + = (mcount + 1 - alloc_count) * sizeof (struct minimal_symbol); + obstack_blank_fast (&m_objfile->per_bfd->storage_obstack, shrink_bytes); msymbols = (struct minimal_symbol *) obstack_finish (&m_objfile->per_bfd->storage_obstack); |