aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2020-02-07 18:20:46 +0100
committerMark Wielaard <mark@klomp.org>2020-02-18 13:09:26 +0100
commitf4354082ba7c9d7d7c88b69a41db34f4f8a88ab5 (patch)
treeb73de15bb55615febc032abdd7884f035fbdb3b9 /src
parent69660c6a828eddbcf703f7bf6a70b56d69516e64 (diff)
downloadelfutils-f4354082ba7c9d7d7c88b69a41db34f4f8a88ab5.tar.gz
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 <drepper@redhat.com> Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog4
-rw-r--r--src/elflint.c4
2 files changed, 8 insertions, 0 deletions
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 <mark@klomp.org>
+
+ * elflint.c (check_symtab): Check st_info isn't too big.
+
2020-01-16 Mark Wielaard <mark@klomp.org>
* 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;