Skip to content

Commit 3f67340

Browse files
edersondisouzakartben
authored andcommitted
subsys/llext: Fail if stated symbol size doesn't fit elf_sym_t
As it avoid unintended overflows. Signed-off-by: Ederson de Souza <[email protected]>
1 parent 77d02aa commit 3f67340

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

subsys/llext/llext_load.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,12 @@ static int llext_find_tables(struct llext_loader *ldr, struct llext *ext)
207207
return -ENOEXEC;
208208
}
209209

210+
if (ldr->sects[LLEXT_MEM_SYMTAB].sh_entsize != sizeof(elf_sym_t) ||
211+
ldr->sects[LLEXT_MEM_SYMTAB].sh_size % ldr->sects[LLEXT_MEM_SYMTAB].sh_entsize != 0) {
212+
LOG_ERR("Invalid symbol table");
213+
return -ENOEXEC;
214+
}
215+
210216
return 0;
211217
}
212218

0 commit comments

Comments
 (0)