Files
mandy/runtime/src
Kal0s-design db8a0cc793 pe_loader: refuse an import address table or TLS index in the headers
After map_image, the loader writes into the mapped image twice: the bound
address of every import and the image's TLS index. Every step after it
(parse_exports, bind_imports, protect_sections, register_unwind,
initialise, ~Loader) reads the headers back from the mapping. A
FirstThunk or AddressOfIndex below SizeOfHeaders therefore replaced
e_lfanew or the section table, and the next read went outside the image
or used headers nobody validated. The loader already refuses a section
or a base relocation there; this closes the two remaining writes.

An index at RVA 0 is refused too: index_rva doubles as "no index", so the
index was silently never written.

Found by mutation fuzzing rt::Loader::load. The six new cases in
test_pe_loader_bounds build their images by hand; four of them fail
without this change.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-24 07:29:32 +01:00
..
…