From 75da835ffbe7c30a3028bcdb8f633293d28d35c0 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 23 Dec 2020 00:50:22 +0100 Subject: [PATCH] LibDebug: Allow DWARF compilation unit header version <= 4 I think this is okay, the main thing to protect against is new versions of the format that we don't know about yet. This happens because an .S file compiled into libc.so has version 2 instead of version 4 like everything else. Fixes #4491. --- Libraries/LibDebug/Dwarf/DwarfInfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/LibDebug/Dwarf/DwarfInfo.cpp b/Libraries/LibDebug/Dwarf/DwarfInfo.cpp index d2fb3d98e6..c1bd4a39c6 100644 --- a/Libraries/LibDebug/Dwarf/DwarfInfo.cpp +++ b/Libraries/LibDebug/Dwarf/DwarfInfo.cpp @@ -60,7 +60,7 @@ void DwarfInfo::populate_compilation_units() stream >> Bytes { &compilation_unit_header, sizeof(compilation_unit_header) }; ASSERT(compilation_unit_header.address_size == sizeof(u32)); - ASSERT(compilation_unit_header.version == 4); + ASSERT(compilation_unit_header.version <= 4); u32 length_after_header = compilation_unit_header.length - (sizeof(CompilationUnitHeader) - offsetof(CompilationUnitHeader, version)); m_compilation_units.empend(*this, unit_offset, compilation_unit_header);