This is the mail archive of the mailing list for the elfutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] elflint: Check sh_info for symtab isn't too big.

The sh_info field of the symtab says how many symbols are in the
section. Make sure at least that many symbols fit in the section.

Reported-by: Ulrich Drepper <>
Signed-off-by: Mark Wielaard <>
 src/ChangeLog | 4 ++++
 src/elflint.c | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/src/ChangeLog b/src/ChangeLog
index 7ce9e54b..e351318b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
+2020-02-07  Mark Wielaard  <>
+	* elflint.c (check_symtab): Check st_info isn't too big.
 2020-01-16  Mark Wielaard  <>
 	* nm.c (show_symbols_sysv): Iterate over all symbols starting
diff --git a/src/elflint.c b/src/elflint.c
index 684b794e..78d485e3 100644
--- a/src/elflint.c
+++ b/src/elflint.c
@@ -658,6 +658,10 @@ section [%2d] '%s': symbol table cannot have more than one extended index sectio
     ERROR (gettext ("\
 section [%2u] '%s': entry size is does not match ElfXX_Sym\n"),
 	   idx, section_name (ebl, idx));
+  else if (shdr->sh_info > shdr->sh_size / sh_entsize)
+    ERROR (gettext ("\
+section [%2u] '%s': number of local entries in 'st_info' larger than table size\n"),
+	   idx, section_name (ebl, idx));
   /* Test the zeroth entry.  */
   GElf_Sym sym_mem;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]