Hi,
When you call dwfl_module_relocations() on a mod that isn't ET_REL, then
it can potentially return the wrong answer because it checks and returns
mod->reloc_info->count. Which for ET_EXEC and ET_DYN can be setup
because someone called dwfl_module_address_section(), but doesn't
correspond to the actual relocation count in that case.
Does the following fix look sane?
2011-10-19 Mark Wielaard <[email protected]>
* derelocate.c (dwfl_module_relocations): Only check
mod->reloc_info->count for ET_REL.
Thanks,
Mark
diff --git a/libdwfl/derelocate.c b/libdwfl/derelocate.c
index ba6d9db..6169ae7 100644
--- a/libdwfl/derelocate.c
+++ b/libdwfl/derelocate.c
@@ -227,12 +227,11 @@ dwfl_module_relocations (Dwfl_Module *mod)
if (mod == NULL)
return -1;
- if (mod->reloc_info != NULL)
- return mod->reloc_info->count;
-
switch (mod->e_type)
{
case ET_REL:
+ if (mod->reloc_info != NULL)
+ return mod->reloc_info->count;
return cache_sections (mod);
case ET_DYN:
_______________________________________________
elfutils-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/elfutils-devel