Skip to content

armgit / rea

Public Imported from GitHub
0

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

fix(ida): compare admitted document paths consistently

morluto890bb66b35d5
diff --git a/src/ida/IdaSessionClient.test.ts b/src/ida/IdaSessionClient.test.ts
index 2b6783c1c..f1bb05467 100644
--- a/src/ida/IdaSessionClient.test.ts
+++ b/src/ida/IdaSessionClient.test.ts
@@ -1,4 +1,5 @@
import { readFile, readdir, rm } from "node:fs/promises";
+import { sep } from "node:path";
import { afterEach, describe, expect, it } from "vitest";
import { z } from "zod";
import {
@@ -111,6 +112,24 @@ describe("headless IDA producer pagination", () => {
});
describe("attached IDA observation semantics", () => {
+ it("accepts a normalized spelling of the bound document path", async () => {
+ const { target, producer, client } = await fixture();
+ const equivalent =
+ process.platform === "win32"
+ ? target.path.toLowerCase().replaceAll("\\", "/")
+ : target.path.split(sep).join(`${sep}.${sep}`);
+
+ const result = await client.execute("list_procedures", {
+ document: equivalent,
+ });
+
+ expect(result.ok).toBe(true);
+ expect(producer.calls.some(({ name }) => name === "list_functions")).toBe(
+ true,
+ );
+ await client.close();
+ });
+
it("rejects an unrelated document before connecting or opening a provider", async () => {
const { producer, client } = await fixture();
const result = await client.execute("list_procedures", {
diff --git a/src/ida/IdaSessionClient.ts b/src/ida/IdaSessionClient.ts
index 5fac9e18e..db6301c0c 100644
--- a/src/ida/IdaSessionClient.ts
+++ b/src/ida/IdaSessionClient.ts
@@ -165,8 +165,10 @@ export class IdaSessionClient implements AnalysisClient {
const document = parameters.document;
if (
document !== undefined &&
- document !== this.target.path &&
- document !== this.target.sourcePath
+ (typeof document !== "string" ||
+ (!sameIdaHostPath(document, this.target.path) &&
+ (this.target.sourcePath === undefined ||
+ !sameIdaHostPath(document, this.target.sourcePath))))
)
return err(
new AnalysisInputError(operation, undefined, [