mirror of
https://github.com/ProjectLeonida/mandy.git
synced 2026-12-06 19:58:36 +00:00
The loader trusted the image it was handed: e_lfanew was dereferenced without checking it against the file size, section copies were bounded by the file but not by SizeOfImage, and the relocation, export and import walks put no limit on where an image's own RVAs sent them. A truncated or corrupt image could read or write outside the mapping the loader had just allocated, and a PE32 image was read through a PE32+ header instead of being rejected. Every RVA is now checked first, and a bad one fails with the file's name and what did not fit. loader_test builds its own images, so ctest covers the good and the corrupt cases without needing any game files.