diff options
author | Eugene Tarassov | 2012-10-03 16:46:14 +0000 |
---|---|---|
committer | Eugene Tarassov | 2012-10-03 16:46:14 +0000 |
commit | ed8b011dac96948a01600339dd2cfbc254539509 (patch) | |
tree | 8527cc9186820125d4709ccb3dd508fd42506dcd | |
parent | 31af5103757e572844862ea1e093e4beed2acc3e (diff) | |
download | org.eclipse.tcf.agent-ed8b011dac96948a01600339dd2cfbc254539509.tar.gz org.eclipse.tcf.agent-ed8b011dac96948a01600339dd2cfbc254539509.tar.xz org.eclipse.tcf.agent-ed8b011dac96948a01600339dd2cfbc254539509.zip |
Bug 391043 - The agent could crash when call enumerate_symbol_table()
-rw-r--r-- | agent/tcf/services/elf-symbols.c | 7 | ||||
-rw-r--r-- | agent/tcf/services/elf-symbols.h | 2 | ||||
-rw-r--r-- | agent/tcf/services/symbols_elf.c | 6 |
3 files changed, 8 insertions, 7 deletions
diff --git a/agent/tcf/services/elf-symbols.c b/agent/tcf/services/elf-symbols.c index e1c05fb0..a6137e50 100644 --- a/agent/tcf/services/elf-symbols.c +++ b/agent/tcf/services/elf-symbols.c @@ -36,7 +36,8 @@ struct EnumerateSymbols { char ctxId[256]; }; -static int enumerate_symbol_table (ELF_Section * sec, EnumerateSymbols * enum_syms, EnumerateBatchSymbolsCallBack * call_back, void * args) { +static int enumerate_symbol_table (Context * ctx, ELF_Section * sec, + EnumerateSymbols * enum_syms, EnumerateBatchSymbolsCallBack * call_back, void * args) { uint32_t sym_idx; int cont = 1; int has_more = 0; @@ -47,7 +48,7 @@ static int enumerate_symbol_table (ELF_Section * sec, EnumerateSymbols * enum_sy unpack_elf_symbol_info(sec, sym_idx, &sym_info); - if (elf_tcf_symbol (&sym_info, &sym) < 0) exception (errno); + if (elf_tcf_symbol (ctx, &sym_info, &sym) < 0) exception (errno); cont = call_back (args, sym); } @@ -127,7 +128,7 @@ int elf_enumerate_symbols (Context * ctx, const char * file_name, EnumerateSymbo (*enum_syms)->sec_idx = sec_idx; } - has_more = enumerate_symbol_table(file->sections + sec_idx, *enum_syms, call_back, args); + has_more = enumerate_symbol_table(ctx, file->sections + sec_idx, *enum_syms, call_back, args); clear_trap(&trap); diff --git a/agent/tcf/services/elf-symbols.h b/agent/tcf/services/elf-symbols.h index 20efd483..f20ac496 100644 --- a/agent/tcf/services/elf-symbols.h +++ b/agent/tcf/services/elf-symbols.h @@ -54,7 +54,7 @@ extern int elf_symbol_info (Symbol * sym, ELF_SymbolInfo * elf_sym); * On error returns -1 and sets errno. * On success returns 0. */ -extern int elf_tcf_symbol (ELF_SymbolInfo * elf_sym, Symbol ** sym); +extern int elf_tcf_symbol (Context * ctx, ELF_SymbolInfo * elf_sym, Symbol ** sym); #endif /* SERVICE_Symbols && !ENABLE_SymbolsProxy && ENABLE_ELF */ diff --git a/agent/tcf/services/symbols_elf.c b/agent/tcf/services/symbols_elf.c index ec8e8979..25ae0176 100644 --- a/agent/tcf/services/symbols_elf.c +++ b/agent/tcf/services/symbols_elf.c @@ -219,11 +219,11 @@ static int syminfo2address(Context * ctx, ELF_SymbolInfo * info, ContextAddress return -1; } -int elf_tcf_symbol(ELF_SymbolInfo * sym_info, Symbol ** symbol) { +int elf_tcf_symbol(Context * ctx, ELF_SymbolInfo * sym_info, Symbol ** symbol) { Symbol * sym = alloc_symbol(); sym->frame = STACK_NO_FRAME; - sym->ctx = context_get_group(sym_ctx, CONTEXT_GROUP_SYMBOLS); + sym->ctx = context_get_group(ctx, CONTEXT_GROUP_SYMBOLS); sym->tbl = sym_info->sym_section; sym->index = sym_info->sym_index; @@ -675,7 +675,7 @@ static void add_obj_to_find_symbol_buf(ObjectInfo * obj, unsigned level) { static void add_elf_to_find_symbol_buf(ELF_SymbolInfo * elf_sym) { Symbol * sym = NULL; - elf_tcf_symbol(elf_sym, &sym); + elf_tcf_symbol(sym_ctx, elf_sym, &sym); add_to_find_symbol_buf(sym); } |