aboutsummaryrefslogtreecommitdiff
path: root/gprof/symtab.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-04-01 12:00:09 +1030
committerAlan Modra <amodra@gmail.com>2019-04-01 13:35:15 +1030
commitf7043f6281dd27b19393b3d18daa227acd9459c6 (patch)
tree4fb86e9e1f758fb6e602844613354e61f9b223eb /gprof/symtab.c
parent91fc2ba707780d150309259571b12c73e92af5d0 (diff)
downloadgdb-f7043f6281dd27b19393b3d18daa227acd9459c6.zip
gdb-f7043f6281dd27b19393b3d18daa227acd9459c6.tar.gz
gdb-f7043f6281dd27b19393b3d18daa227acd9459c6.tar.bz2
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.
Diffstat (limited to 'gprof/symtab.c')
-rw-r--r--gprof/symtab.c4
1 files changed, 2 insertions, 2 deletions
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] == '_'))))))
{