From 50219429fdf134ce01c9beeba7031278c3251c0b Mon Sep 17 00:00:00 2001 From: Itamar Date: Wed, 11 Nov 2020 22:04:33 +0200 Subject: [PATCH] LibELF: Allow using ELF::Loader for ET_CORE objects --- Libraries/LibELF/Validation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/LibELF/Validation.cpp b/Libraries/LibELF/Validation.cpp index cb042b499c..0afa0a54c5 100644 --- a/Libraries/LibELF/Validation.cpp +++ b/Libraries/LibELF/Validation.cpp @@ -163,7 +163,7 @@ bool validate_elf_header(const Elf32_Ehdr& elf_header, size_t file_size, bool ve return false; } - if (elf_header.e_shstrndx >= elf_header.e_shnum) { + if (elf_header.e_shstrndx != SHN_UNDEF && elf_header.e_shstrndx >= elf_header.e_shnum) { if (verbose) dbgprintf("SHENANIGANS! Section header string table index (%d) is not a valid index given we have %d section headers!\n", elf_header.e_shstrndx, elf_header.e_shnum); return false;