fix(ghidra): resolve exact external function entries
This commit is contained in:
@@ -31,18 +31,6 @@ describe("containing-procedure complete body evidence", () => {
|
||||
found: true,
|
||||
procedure: identity(),
|
||||
});
|
||||
it("accepts the Java producer identity including complete inclusive body ranges", () => {
|
||||
const value = found();
|
||||
expect(
|
||||
parseGhidraInventoryResult("resolve_containing_procedure", value),
|
||||
).toEqual({ ok: true, value });
|
||||
expect(
|
||||
parseGhidraInventoryResult("resolve_containing_procedure", {
|
||||
...value,
|
||||
query_address: "0x1021",
|
||||
}).ok,
|
||||
).toBe(true);
|
||||
});
|
||||
it("rejects a missing body rather than treating a legacy identity as complete", () => {
|
||||
const { body: omitted, ...legacy } = identity();
|
||||
expect(omitted.total_bytes).toBe(5);
|
||||
@@ -108,15 +96,4 @@ describe("containing-procedure complete body evidence", () => {
|
||||
}).ok,
|
||||
).toBe(false);
|
||||
});
|
||||
it("retains explicit not-found outcomes without fabricating a body", () => {
|
||||
const value = {
|
||||
query_address: "0x1010",
|
||||
found: false,
|
||||
procedure: null,
|
||||
reason: "not_in_procedure",
|
||||
};
|
||||
expect(
|
||||
parseGhidraInventoryResult("resolve_containing_procedure", value),
|
||||
).toEqual({ ok: true, value });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -219,7 +219,11 @@ const containingProcedure = z.discriminatedUnion("found", [
|
||||
.strict()
|
||||
.superRefine((value, context) => {
|
||||
const body = value.procedure.body;
|
||||
const exactExternalEntry =
|
||||
value.procedure.classification.external &&
|
||||
value.query_address === value.procedure.address;
|
||||
if (
|
||||
!exactExternalEntry &&
|
||||
body.available &&
|
||||
!functionBodyEntryAgrees(
|
||||
{ ...body, contains_entry: true },
|
||||
|
||||
@@ -85,6 +85,11 @@ export const limitationsFor = (operation: string): readonly string[] => {
|
||||
...common,
|
||||
"Only Ghidra-defined string Data is observed; charset is reported, while a non-missing terminator cannot distinguish a present terminator from a fixed or Pascal layout.",
|
||||
];
|
||||
case "resolve_containing_procedure":
|
||||
return [
|
||||
...common,
|
||||
"An exact external entry resolves to its observed function identity even when its body is empty. This does not establish mapped executable bytes or containment of nearby external addresses.",
|
||||
];
|
||||
case "list_segments":
|
||||
return [
|
||||
...common,
|
||||
|
||||
Reference in New Issue
Block a user