This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] PR24402, global buffer overflow in symtab_finalize
- From: Alan Modra <amodra at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 1 Apr 2019 03:05:37 -0000
- Subject: [binutils-gdb] PR24402, global buffer overflow in symtab_finalize
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f7043f6281dd27b19393b3d18daa227acd9459c6
commit f7043f6281dd27b19393b3d18daa227acd9459c6
Author: Alan Modra <amodra@gmail.com>
Date: Mon Apr 1 12:00:09 2019 +1030
PR24402, global buffer overflow in symtab_finalize
PR 24402
* symtab.c (symtab_finalize): Init prev_addr to one less than
first symbol address, not one more. Correct test for symbols
with leading underscores.
Diff:
---
gprof/ChangeLog | 7 +++++++
gprof/symtab.c | 4 ++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/gprof/ChangeLog b/gprof/ChangeLog
index a1da7e5..9815b15 100644
--- a/gprof/ChangeLog
+++ b/gprof/ChangeLog
@@ -1,3 +1,10 @@
+2019-04-01 Alan Modra <amodra@gmail.com>
+
+ PR 24402
+ * symtab.c (symtab_finalize): Init prev_addr to one less than
+ first symbol address, not one more. Correct test for symbols
+ with leading underscores.
+
2019-01-21 Nick Clifton <nickc@redhat.com>
* po/tr.po: Updated Turkish translation.
diff --git a/gprof/symtab.c b/gprof/symtab.c
index 740168c..70eb415 100644
--- a/gprof/symtab.c
+++ b/gprof/symtab.c
@@ -89,7 +89,7 @@ symtab_finalize (Sym_Table *tab)
/* Remove duplicate entries to speed-up later processing and
set end_addr if its not set yet. */
- prev_addr = tab->base[0].addr + 1;
+ prev_addr = tab->base[0].addr - 1;
for (src = dst = tab->base; src < tab->limit; ++src)
{
@@ -107,7 +107,7 @@ symtab_finalize (Sym_Table *tab)
&& ((src->is_func && !dst[-1].is_func)
|| ((src->is_func == dst[-1].is_func)
&& ((src->name[0] != '_' && dst[-1].name[0] == '_')
- || (src->name[0]
+ || (src->name[0] == '_' && dst[-1].name[0] == '_'
&& src->name[1] != '_'
&& dst[-1].name[1] == '_'))))))
{