feat(ghidra): add DOS MZ analysis and complete function extents (#556)
Validate DOS MZ load modules and import them with Ghidra's 16-bit real-mode profile. Preserve complete observed inclusive function body ranges through inventory, function analysis, Evidence and snapshots. Add a public source-generated DOS CLI/MCP verification lane and regressions for malformed headers, body membership and cache profiles. Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing) Assisted-by: Suika (gensokyo-skills:suika-scatter-gather-planning)
This commit is contained in:
@@ -90,6 +90,10 @@ export const hopperLoaderArgsForTarget = (
|
||||
return ok(["-l", "ELF", flag]);
|
||||
case "pe":
|
||||
return ok(["-l", "WinPE", flag]);
|
||||
case "dos-mz":
|
||||
return err(
|
||||
new ProviderAdapterError("hopper", "resolve_analysis_profile"),
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -8,6 +8,26 @@ import {
|
||||
} from "./HopperProvider.js";
|
||||
|
||||
describe("Hopper provider capabilities", () => {
|
||||
it("declines DOS MZ targets with a provider-specific support reason", () => {
|
||||
const config = parseConfig({});
|
||||
if (!config.ok) throw new Error("expected valid configuration");
|
||||
const provider = new HopperProvider(config.value, silentLogger);
|
||||
expect(
|
||||
provider.inspectTargetSupport({
|
||||
path: "/tmp/legacy.exe",
|
||||
sha256: "a".repeat(64),
|
||||
kind: "executable",
|
||||
format: "dos-mz",
|
||||
architecture: "x86",
|
||||
availableArchitectures: ["x86"],
|
||||
}),
|
||||
).toMatchObject({
|
||||
status: "unsupported",
|
||||
code: "target_format_unsupported",
|
||||
reason: expect.stringContaining("Ghidra"),
|
||||
});
|
||||
});
|
||||
|
||||
it("publishes deterministic descriptors and resists caller mutation", () => {
|
||||
const config = parseConfig({});
|
||||
expect(config.ok).toBe(true);
|
||||
|
||||
@@ -154,6 +154,13 @@ export class HopperProvider implements AnalysisProviderCandidate {
|
||||
reason: null,
|
||||
diagnostics,
|
||||
};
|
||||
if (target.format === "dos-mz")
|
||||
return {
|
||||
status: "unsupported",
|
||||
code: "target_format_unsupported",
|
||||
reason: "DOS MZ analysis requires the Ghidra 16-bit real-mode adapter.",
|
||||
diagnostics,
|
||||
};
|
||||
return {
|
||||
status: "supported",
|
||||
code: null,
|
||||
|
||||
Reference in New Issue
Block a user