]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Fix unsigned overflow in minsyms reader.
authorJohn Baldwin <jhb@FreeBSD.org>
Fri, 9 Nov 2018 19:44:20 +0000 (11:44 -0800)
committerJohn Baldwin <jhb@FreeBSD.org>
Fri, 9 Nov 2018 19:44:20 +0000 (11:44 -0800)
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.

gdb/ChangeLog
gdb/minsyms.c

index b6c612bd0b2039b30c6726f7417c9cbf7bdbab07..4a7936406585e5b46f5d60003e2285584c1e55de 100644 (file)
@@ -1,3 +1,8 @@
+2018-11-09  John Baldwin  <jhb@FreeBSD.org>
+
+       * minsyms.c (minimal_symbol_reader::install): Fix unsigned
+       overflow.
+
 2018-11-09  Hafiz Abid Qadeer  <abidh@codesourcery.com>
 
        * configure: Regenerate.
index 4409e6f8b3a3791e6d5d533afabe323799bb8cf3..0f854422e0f7bdfc7dfb8efe2278428cdc46e72a 100644 (file)
@@ -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);