fix(ghidra): return complete native analysis results

This commit is contained in:
morluto
2026-09-29 08:45:49 +08:00
parent 5457f4a2bc
commit a66e43a99d
16 changed files with 71 additions and 249 deletions
+3 -3
View File
@@ -12,7 +12,7 @@ export const GHIDRA_REQUEST_TIMEOUT_MS = 10_000;
export const GHIDRA_DECOMPILE_TIMEOUT_SECONDS = 30;
/** Socket deadline leaves bounded time to project a native decompiler timeout. */
export const GHIDRA_DECOMPILE_REQUEST_TIMEOUT_MS = 35_000;
/** Maximum encoded response line accepted from the Java bridge. */
export const GHIDRA_MAX_LINE_BYTES = 1024 * 1024;
/** Internal safety bound for one complete Java bridge process response line. */
export const GHIDRA_MAX_LINE_BYTES = 64 * 1024 * 1024;
/** Version of REA's Java bridge handshake and request protocol. */
export const GHIDRA_BRIDGE_VERSION = 6;
export const GHIDRA_BRIDGE_VERSION = 7;
+1 -1
View File
@@ -419,7 +419,7 @@ describe("Ghidra result projection", () => {
const sessionInfo = () => ({
name: "REA Ghidra bridge" as const,
bridge_version: 6 as const,
bridge_version: 7 as const,
run_id: "11111111-1111-4111-8111-111111111111",
profile_digest: "a".repeat(64),
provider: { id: "ghidra" as const, version: "12.1.2" },
+2 -3
View File
@@ -95,13 +95,13 @@ export const limitationsFor = (operation: string): readonly string[] => {
case "read_function_instructions":
return [
...common,
"This bounded fast path reads only the requested function instruction window and does not invoke the decompiler or whole-program string/name inventories.",
"This fast path reads only the requested function and does not invoke the decompiler or whole-program string/name inventories.",
"Instruction text is Ghidra-specific and does not claim textual equivalence with Hopper output.",
];
case "procedure_assembly":
return [
...common,
"Assembly is Ghidra Listing text and fails rather than silently truncating when the 100,000-instruction or 1 MiB wire bound is exceeded.",
"Assembly is Ghidra Listing text and does not claim textual equivalence with Hopper output.",
];
case "procedure_callers":
case "procedure_callees":
@@ -120,7 +120,6 @@ export const limitationsFor = (operation: string): readonly string[] => {
...common,
"Reference kinds are direct Ghidra ReferenceManager observations; unresolved computed flows without a target are absent and remain unknown.",
"Synthetic Ghidra entry-point references without actionable memory sources are omitted.",
"Instruction scans stop at max_instructions; a truncated scan reports an unknown total and no false continuation.",
];
case "analyze_function":
return [
+22
View File
@@ -0,0 +1,22 @@
import { describe, expect, it } from "vitest";
import { GHIDRA_MAX_LINE_BYTES } from "./GhidraDefaults.js";
import { GhidraResponseBuffer } from "./GhidraResponseBuffer.js";
describe("Ghidra response buffer", () => {
it("accepts complete responses larger than the former 1 MiB ceiling", () => {
const lines: string[] = [];
const failures: string[] = [];
const buffer = new GhidraResponseBuffer({
maxLineBytes: GHIDRA_MAX_LINE_BYTES,
onLine: (line) => lines.push(line),
onFailure: (message) => failures.push(message),
});
const response = `{"result":"${"x".repeat(1_100_000)}"}`;
buffer.push(`${response}\n`);
expect(failures).toEqual([]);
expect(lines).toEqual([response]);
});
});