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.
This commit is contained in:
yusufcanislek
2026-03-26 12:35:26 +03:00
parent 5717d28fde
commit 7b9029a2ca
2 changed files with 11 additions and 5 deletions
+6 -4
View File
@@ -40,10 +40,12 @@ createConfiguredLifterForRuntime(uint8_t* fileBase, uint64_t runtimeAddress) {
auto* funcRVAs = reinterpret_cast<const uint32_t*>(
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);
}
}
}
+5 -1
View File
@@ -164,8 +164,12 @@ ParseResult parseArguments(const std::vector<std::string>& 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 {