Explorar o código

Kernel: Ignore zero-sized PT_LOAD headers when loading ELF images

Andreas Kling %!s(int64=3) %!d(string=hai) anos
pai
achega
5046a1fe38
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      Kernel/Syscalls/execve.cpp

+ 3 - 0
Kernel/Syscalls/execve.cpp

@@ -338,6 +338,9 @@ static KResultOr<LoadResult> load_elf_object(NonnullOwnPtr<Memory::AddressSpace>
         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());