1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 03:27:44 +00:00
serenity/Userland/Libraries/LibELF
Ben Wiederhake ec91f8ad1d LibELF: Avoid quadratic memory usage weakness
Section names are referred to by offset and length. We do not check
(and probably should not check) whether these names overlap in any way.
This opened the door to many sections (in this example: about 2700)
forcing ELF::Image::m_sections to contain endless copies of the same
huge string (in this case: 882K).

Fix this by loading only the first PAGE_SIZE bytes of each name.
Since section names are only relevant for relocations and debug
information and most section names are hard-coded (and far below 4096
bytes) anyway, this should be no restriction at all for 'normal'
executables.

Found by OSS-Fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29187
2021-01-30 09:25:02 +01:00
..
Arch/i386 Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
AuxiliaryVector.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
CMakeLists.txt Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
CoreDump.h Kernel: Set "pledge_violation" coredump metadata in REQUIRE_PROMISE() 2021-01-20 21:01:15 +01:00
DynamicLinker.cpp LibELF: Use Optional<SymbolLookupResult> as a return type 2021-01-25 18:57:06 +01:00
DynamicLinker.h LibELF: Use Optional<SymbolLookupResult> as a return type 2021-01-25 18:57:06 +01:00
DynamicLoader.cpp DynamicLoader: load_program_headers use variables to store regions (#5173) 2021-01-30 09:21:54 +01:00
DynamicLoader.h LibELF: Cache the DynamicObject in DynamicLoader 2021-01-25 18:57:06 +01:00
DynamicObject.cpp LibELF: Use Optional<SymbolLookupResult> as a return type 2021-01-25 18:57:06 +01:00
DynamicObject.h LibELF: Use Optional<SymbolLookupResult> as a return type 2021-01-25 18:57:06 +01:00
exec_elf.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
Image.cpp LibELF: Avoid quadratic memory usage weakness 2021-01-30 09:25:02 +01:00
Image.h Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
Validation.cpp LibELF: validate_program_headers: Validate PT_INTERP header p_filesz > 1 2021-01-16 22:39:26 +01:00
Validation.h Libraries: Add missing headers 2021-01-22 21:49:54 +01:00