From 091176d85dd9118601133b365ec23720b7269684 Mon Sep 17 00:00:00 2001 From: Maurice Heumann Date: Sun, 13 Jun 2021 08:56:55 +0200 Subject: [PATCH] Verify mapped binary base #221 --- src/client/loader/loader.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/client/loader/loader.cpp b/src/client/loader/loader.cpp index 9f2f241..1bc7b41 100644 --- a/src/client/loader/loader.cpp +++ b/src/client/loader/loader.cpp @@ -36,7 +36,13 @@ FARPROC loader::load_library(const std::string& filename) const const auto target = utils::nt::library::load(filename); if (!target) { - throw std::runtime_error("Failed to map binary!"); + throw std::runtime_error{"Failed to map binary!"}; + } + + const auto base = size_t(target.get_ptr()); + if(base != 0x140000000) + { + throw std::runtime_error{utils::string::va("Binary was mapped at 0x%llX (instead of 0x%llX). Something is severely broken :(", base, 0x140000000)}; } this->load_imports(target, target);