X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=libelf%2Fnlist.c;h=c7b32fdbe1d17bb8d2c100d3f605cdfdcbb16cca;hb=82c3b58b54026d061a4d81ad95f3023d5d883ab2;hp=41e5ff6472facdd0e72d22fb75517956ed590a39;hpb=a286dd013ef8d46edf013efc0908822a59d8ac81;p=platform%2Fupstream%2Felfutils.git diff --git a/libelf/nlist.c b/libelf/nlist.c index 41e5ff6..c7b32fd 100644 --- a/libelf/nlist.c +++ b/libelf/nlist.c @@ -1,5 +1,5 @@ /* Extract symbol list from binary. - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005, 2007 Red Hat, Inc. + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005, 2007, 2015 Red Hat, Inc. This file is part of elfutils. Written by Ulrich Drepper , 1998. @@ -116,7 +116,11 @@ nlist (const char *filename, struct nlist *nl) /* Re-get the section header in case we found only the dynamic symbol table. */ if (scn == NULL) - shdr = INTUSE(gelf_getshdr) (symscn, &shdr_mem); + { + shdr = INTUSE(gelf_getshdr) (symscn, &shdr_mem); + if (unlikely (shdr == NULL)) + goto fail_close; + } /* SHDR->SH_LINK now contains the index of the string section. */ /* Get the data for the symbol section. */ @@ -126,7 +130,7 @@ nlist (const char *filename, struct nlist *nl) /* How many symbols are there? */ nsyms = (shdr->sh_size - / INTUSE(gelf_fsize) (elf, ELF_T_SYM, 1, data->d_version)); + / INTUSE(gelf_fsize) (elf, ELF_T_SYM, 1, EV_CURRENT)); /* Create the hash table. */ table = nlist_fshash_init (nsyms);