From a16a88b5f99ae2dfa56bb2e0e3ed2cf0da7d1c81 Mon Sep 17 00:00:00 2001 From: EnderIce2 Date: Mon, 7 Apr 2025 05:35:17 +0000 Subject: [PATCH] fix(kernel): validate symbol entries to prevent processing of invalid symbols --- Kernel/core/symbols.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Kernel/core/symbols.cpp b/Kernel/core/symbols.cpp index 28292fc8..d0fbcd2b 100644 --- a/Kernel/core/symbols.cpp +++ b/Kernel/core/symbols.cpp @@ -178,6 +178,12 @@ namespace SymbolResolver continue; } + if (unlikely(sym->st_name == (Elf_Word)-1 || sym->st_value == (Elf_Addr)-1 || sym->st_size == (uintptr_t)-1)) + { + error("Symbol %d is invalid", i); + continue; + } + name = (const char *)&StringAddress[Symbols[i].st_name]; if (!vmm.Check((void *)name)) {