Skip to content

Commit f7043f6

Browse files
committed
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.
1 parent 91fc2ba commit f7043f6

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

gprof/ChangeLog

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2019-04-01 Alan Modra <amodra@gmail.com>
2+
3+
PR 24402
4+
* symtab.c (symtab_finalize): Init prev_addr to one less than
5+
first symbol address, not one more. Correct test for symbols
6+
with leading underscores.
7+
18
2019-01-21 Nick Clifton <nickc@redhat.com>
29

310
* po/tr.po: Updated Turkish translation.

gprof/symtab.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ symtab_finalize (Sym_Table *tab)
8989

9090
/* Remove duplicate entries to speed-up later processing and
9191
set end_addr if its not set yet. */
92-
prev_addr = tab->base[0].addr + 1;
92+
prev_addr = tab->base[0].addr - 1;
9393

9494
for (src = dst = tab->base; src < tab->limit; ++src)
9595
{
@@ -107,7 +107,7 @@ symtab_finalize (Sym_Table *tab)
107107
&& ((src->is_func && !dst[-1].is_func)
108108
|| ((src->is_func == dst[-1].is_func)
109109
&& ((src->name[0] != '_' && dst[-1].name[0] == '_')
110-
|| (src->name[0]
110+
|| (src->name[0] == '_' && dst[-1].name[0] == '_'
111111
&& src->name[1] != '_'
112112
&& dst[-1].name[1] == '_'))))))
113113
{

0 commit comments

Comments
 (0)