diff options
| author | Mark Wielaard <[email protected]> | 2015-06-18 10:46:20 +0200 |
|---|---|---|
| committer | Mark Wielaard <[email protected]> | 2015-06-19 12:24:46 +0200 |
| commit | 821e15c6ca716b17b3d3b678cfb17d12ef9bcf25 (patch) | |
| tree | 4d303f3ea64934b75ff5925f46d79adec5218b8f | |
| parent | 65e58829fa0b6359735625e27309ae5eec7d810e (diff) | |
libdwfl: Check symbol section exists and has a sane entsize in find_symtab.
Signed-off-by: Mark Wielaard <[email protected]>
| -rw-r--r-- | libdwfl/ChangeLog | 5 | ||||
| -rw-r--r-- | libdwfl/dwfl_module_getdwarf.c | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index a5253e26..ca987833 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,8 @@ +2015-06-18 Mark Wielaard <[email protected]> + + * dwfl_module_getdwarf.c (find_symtab): Check shdr is not NULL and + sh_entsize is not zero. + 2015-06-06 Mark Wielaard <[email protected]> * find-debuginfo.c (find_debuginfo_in_path): Always free localpath, diff --git a/libdwfl/dwfl_module_getdwarf.c b/libdwfl/dwfl_module_getdwarf.c index 908a9eee..dba9d664 100644 --- a/libdwfl/dwfl_module_getdwarf.c +++ b/libdwfl/dwfl_module_getdwarf.c @@ -1135,7 +1135,8 @@ find_symtab (Dwfl_Module *mod) // Sanity check number of symbols. GElf_Shdr shdr_mem, *shdr = gelf_getshdr (symscn, &shdr_mem); - if (mod->syments > mod->symdata->d_size / shdr->sh_entsize + if (shdr == NULL || shdr->sh_entsize == 0 + || mod->syments > mod->symdata->d_size / shdr->sh_entsize || (size_t) mod->first_global > mod->syments) goto elferr; |
