From 7b9029a2ca714e57ee2e9ce8b46bf64802176e10 Mon Sep 17 00:00:00 2001 From: yusufcanislek Date: Thu, 26 Mar 2026 12:35:26 +0300 Subject: [PATCH] fix: filter forwarded exports + validate --outline= empty value P1: Export parsing now skips forwarded exports (RVA within the export directory range points to an ASCII forwarder string, not code). P2: --outline= (with equals but no value) now produces an explicit error instead of silently consuming the next positional argument. --- lifter/core/LifterStages.hpp | 10 ++++++---- lifter/core/Utils.cpp | 6 +++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lifter/core/LifterStages.hpp b/lifter/core/LifterStages.hpp index e5d52ce..21cb87a 100644 --- a/lifter/core/LifterStages.hpp +++ b/lifter/core/LifterStages.hpp @@ -40,10 +40,12 @@ createConfiguredLifterForRuntime(uint8_t* fileBase, uint64_t runtimeAddress) { auto* funcRVAs = reinterpret_cast( fileBase + funcTableOff); for (uint32_t i = 0; i < exp->num_functions; ++i) { - if (funcRVAs[i] != 0) { - uint64_t va = imageBase + funcRVAs[i]; - lifter->inlinePolicy.addAddress(va); - } + uint32_t rva = funcRVAs[i]; + if (rva == 0) continue; + // Skip forwarded exports: RVA points within the export directory + // itself (to an ASCII forwarder string, not code). + if (rva >= expDir.rva && rva < expDir.rva + expDir.size) continue; + lifter->inlinePolicy.addAddress(imageBase + rva); } } } diff --git a/lifter/core/Utils.cpp b/lifter/core/Utils.cpp index 86093d6..fadc9b4 100644 --- a/lifter/core/Utils.cpp +++ b/lifter/core/Utils.cpp @@ -164,8 +164,12 @@ ParseResult parseArguments(const std::vector& args, } if (arg == "--outline" || arg.rfind("--outline=", 0) == 0) { std::string value; - if (arg.size() > 10 && arg[9] == '=') { + if (arg.rfind("--outline=", 0) == 0) { value = arg.substr(10); + if (value.empty()) { + result.errors.push_back("--outline= requires a value after '='"); + continue; + } } else if (index + 1 < args.size()) { value = args[++index]; } else {