fix(native): preserve compact reference provenance (#1438)
Co-authored-by: N0zoM1z0 <161784452+N0zoM1z0@users.noreply.github.com>
This commit is contained in:
co-authored by
N0zoM1z0
parent
2ec93ba166
commit
24d9337649
@@ -0,0 +1,60 @@
|
||||
import type { JsonValue } from "../jsonValue.js";
|
||||
|
||||
/** Wire-boundary controls; these do not establish real Ghidra behavior. */
|
||||
export const compactReference = () => ({
|
||||
source_address: "0x401000",
|
||||
target_address: "0x402000",
|
||||
type: "COMPUTED_CALL",
|
||||
call: true,
|
||||
jump: false,
|
||||
indirect: false,
|
||||
computed: true,
|
||||
operand_index: 1,
|
||||
data: false,
|
||||
read: false,
|
||||
write: false,
|
||||
primary: false,
|
||||
provenance: "ghidra-reference-manager",
|
||||
source: "analysis",
|
||||
});
|
||||
|
||||
export const compactInstruction = (references: JsonValue[] = []) => ({
|
||||
address: "0x401000",
|
||||
status: "decoded",
|
||||
procedure: "0x401000",
|
||||
architecture: "x86:LE:32:default",
|
||||
mode: "default",
|
||||
bytes: "ffd0",
|
||||
length: 2,
|
||||
mnemonic: "CALL",
|
||||
raw_disassembly: "CALL EAX",
|
||||
operands: [],
|
||||
flow: {
|
||||
kind: "call",
|
||||
conditional: false,
|
||||
computed: true,
|
||||
direct_destinations: [],
|
||||
},
|
||||
references,
|
||||
limitations: ["Static references do not establish runtime targets."],
|
||||
});
|
||||
|
||||
export const compactCallTargets = (references: JsonValue[] = []) => ({
|
||||
call_site: "0x401000",
|
||||
procedure: "0x401000",
|
||||
status: references.length === 0 ? "unresolved" : "resolved-indirect",
|
||||
mechanism: "computed",
|
||||
targets:
|
||||
references.length === 0
|
||||
? []
|
||||
: [
|
||||
{
|
||||
address: "0x402000",
|
||||
procedure: null,
|
||||
status: "resolved-indirect",
|
||||
basis: "provider-reference",
|
||||
references,
|
||||
},
|
||||
],
|
||||
limitations: ["Static references do not establish runtime targets."],
|
||||
});
|
||||
@@ -13,6 +13,33 @@ const reference = z.strictObject({
|
||||
indirect: z.boolean(),
|
||||
computed: z.boolean(),
|
||||
operand_index: z.number().int(),
|
||||
source_address: z.string().min(1).nullable().optional(),
|
||||
data: z.boolean().nullable().optional(),
|
||||
read: z.boolean().nullable().optional(),
|
||||
write: z.boolean().nullable().optional(),
|
||||
primary: z
|
||||
.boolean()
|
||||
.nullable()
|
||||
.optional()
|
||||
.describe(
|
||||
"Provider primary-reference status, not proof of literal addressing or a runtime access. Null or omission means unavailable.",
|
||||
),
|
||||
provenance: z
|
||||
.string()
|
||||
.min(1)
|
||||
.nullable()
|
||||
.optional()
|
||||
.describe(
|
||||
"Provider subsystem reporting this reference; null or omission means unavailable.",
|
||||
),
|
||||
source: z
|
||||
.string()
|
||||
.min(1)
|
||||
.nullable()
|
||||
.optional()
|
||||
.describe(
|
||||
"Provider reference origin, such as analysis, default, imported or user_defined; null or omission means unavailable.",
|
||||
),
|
||||
});
|
||||
/** Provider-decoded facts for one instruction; operand tokens preserve their native ordering. */
|
||||
export const nativeInstructionSchema = z.strictObject({
|
||||
|
||||
Reference in New Issue
Block a user