mirror of
https://github.com/NaC-L/Mergen.git
synced 2026-06-11 09:44:31 +00:00
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:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user