This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Fix unsigned overflow in minsyms reader.


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9c122c7f9c8260d2cceb1e8f29d69607531f43ba

commit 9c122c7f9c8260d2cceb1e8f29d69607531f43ba
Author: John Baldwin <jhb@FreeBSD.org>
Date:   Fri Nov 9 11:44:20 2018 -0800

    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.

Diff:
---
 gdb/ChangeLog | 5 +++++
 gdb/minsyms.c | 5 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b6c612b..4a79364 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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.
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index 4409e6f..0f85442 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);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]