fix(ghidra): warn when callee/caller reads stop at a truncated function body (#2360)

procedure_callees and procedure_callers returned a bare address list, so an
inferred no-return call that truncates Ghidra's function body silently dropped
real edges (fixes #2326). Wrap both views in the function-observation envelope
with noReturnCallLimitations, matching procedure_info, procedure_assembly,
procedure_pseudo_code, read_function_instructions, and analyze_function
(precedent: 69a8b3a95). Version the boundary-observation contract to
ghidra-terminal-call-limitations-v2 so older snapshots cannot replay
unqualified results.

Validation: red->green unit test for the envelope requirement, MCP boundary
evidence test extended for both views (limitations retained through Evidence
and snapshot replay), 8 harness test files + ghidra behavior tests green,
check:fast, docs:check, verify:test-discovery green. Real Ghidra host lane
unavailable here (no Ghidra installed); Java change mirrors the existing
procedureInfo call pattern.
This commit is contained in:
Saim Shafique
2026-10-13 21:26:57 +08:00
committed by GitHub
parent dea770d5d9
commit 6637161e02
9 changed files with 52 additions and 11 deletions
+25
View File
@@ -23,6 +23,8 @@ import {
const observationOperations: ReadonlySet<GhidraFunctionOperation> = new Set([
"analyze_function",
"procedure_assembly",
"procedure_callees",
"procedure_callers",
"procedure_info",
"procedure_pseudo_code",
"read_function_instructions",
@@ -93,6 +95,29 @@ describe("Ghidra function-analysis result values", () => {
});
});
it.each(["procedure_callees", "procedure_callers"] as const)(
"requires the function-observation envelope to carry terminal-call limitations for %s",
(operation) => {
// A bare address list is the pre-fix bridge shape; without the envelope
// a truncated function body reports no warning, so it must be rejected.
expect(parseGhidraFunctionResult(operation, ["0x2000"])).toMatchObject({
ok: false,
error: { _tag: "AnalysisOutputError" },
});
const limitation =
"Ghidra Listing reports a terminal call at 0x401000 to 0x402000 abort; fallthrough is excluded by Ghidra's flow model.";
expect(
parseGhidraFunctionResult(operation, {
value: ["0x2000"],
limitations: [limitation],
}),
).toEqual({
ok: true,
value: { value: ["0x2000"], limitations: [limitation] },
});
},
);
it.each(["reference_kinds_available", "unresolved_calls"])(
"rejects omitted %s instead of inventing complete reference observations",
(field) => {