Skip to content

armgit / rea

Public Imported from GitHub
0

Reverse engineer anything with agents, from app behavior down to native binaries.

fix(ida): keep omitted callee truncation markers unknown (#4286)

Vinícius Andradecc4ed5b90433
diff --git a/src/ida/IdaCalleeRelationships.test.ts b/src/ida/IdaCalleeRelationships.test.ts
index 9bab2074a..358c83b88 100644
--- a/src/ida/IdaCalleeRelationships.test.ts
+++ b/src/ida/IdaCalleeRelationships.test.ts
@@ -170,6 +170,33 @@ describe("headless IDA callee edges on x86 targets", () => {
}
});
+ it("keeps omitted x86 callee truncation as unknown coverage", async () => {
+ const { client, producer } = await session({ callees: [] }, "x86_64");
+ const inner = producer.overrideCall;
+ producer.overrideCall = (name, args) =>
+ name === "callees"
+ ? [
+ {
+ callees: [{ addr: "0x2000", name: "square", type: "internal" }],
+ },
+ ]
+ : inner?.(name, args);
+ try {
+ const execution = await callees(client);
+
+ expect(execution.result, "observed callees are still returned").toEqual([
+ "0x2000",
+ ]);
+ expect(execution.relationshipCoverage).toMatchObject({
+ status: "unknown",
+ reason:
+ "Upstream callees omitted an explicit truncation marker; additional callees remain unknown.",
+ });
+ } finally {
+ expect((await client.close()).ok).toBe(true);
+ }
+ });
+
it("keeps an empty x86 callees reply an observed empty list without any limitation", async () => {
const { client, producer } = await session({ callees: [] }, "x86_64");
try {
diff --git a/src/ida/IdaOperationRunner.ts b/src/ida/IdaOperationRunner.ts
index 4e42a063e..382374e70 100644
--- a/src/ida/IdaOperationRunner.ts
+++ b/src/ida/IdaOperationRunner.ts
@@ -535,7 +535,13 @@ export class IdaOperationRunner {
"Upstream callees capped results at 500; additional callees remain unknown.",
],
}
- : { status: "complete" };
+ : page.more === false
+ ? { status: "complete" }
+ : {
+ status: "unknown",
+ reason:
+ "Upstream callees omitted an explicit truncation marker; additional callees remain unknown.",
+ };
for (const item of page.callees) {
if ("type" in item && item.type === "external")
result.set(
diff --git a/tests/boundary/providers/ida/calleeRelationships.test.ts b/tests/boundary/providers/ida/calleeRelationships.test.ts
index 523304dac..d459413c1 100644
--- a/tests/boundary/providers/ida/calleeRelationships.test.ts
+++ b/tests/boundary/providers/ida/calleeRelationships.test.ts
@@ -351,3 +351,34 @@ it("preserves an explicit root cap below the edge limit through every relationsh
expect((await client.close()).ok).toBe(true);
}
});
+
+it("does not treat omitted x86 callee truncation as a definite miss", async () => {
+ const { client, producer } = await callGraphSession(
+ {
+ callees: [{ addr: "0x2000", name: "square", type: "internal" }],
+ },
+ "x86_64",
+ );
+ const inner = producer.overrideCall;
+ producer.overrideCall = (name, args) =>
+ name === "callees"
+ ? [{ callees: [{ addr: "0x2000", name: "square", type: "internal" }] }]
+ : inner?.(name, args);
+ try {
+ const result = await new EnhancedTools(client).execute("trace_call_path", {
+ start: "main",
+ goal: "0x3000",
+ });
+ if (!result.ok) throw result.error;
+ expect(result.value).toMatchObject({
+ goal_status: "unknown",
+ residual_unknowns: expect.arrayContaining([
+ expect.stringContaining(
+ "Call relationship coverage is unknown for 0x1000:",
+ ),
+ ]),
+ });
+ } finally {
+ expect((await client.close()).ok).toBe(true);
+ }
+});