From 5046a1fe38193ab7e47f91b5f068b86788f801f6 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 31 Aug 2021 16:33:26 +0200 Subject: [PATCH] Kernel: Ignore zero-sized PT_LOAD headers when loading ELF images --- Kernel/Syscalls/execve.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Kernel/Syscalls/execve.cpp b/Kernel/Syscalls/execve.cpp index cf9eb5e329..4002e0d279 100644 --- a/Kernel/Syscalls/execve.cpp +++ b/Kernel/Syscalls/execve.cpp @@ -338,6 +338,9 @@ static KResultOr load_elf_object(NonnullOwnPtr if (program_header.type() != PT_LOAD) return IterationDecision::Continue; + if (program_header.size_in_memory() == 0) + return IterationDecision::Continue; + if (program_header.is_writable()) { // Writable section: create a copy in memory. VERIFY(program_header.size_in_memory());