fix(analysis): preserve producer identity and partial evidence
Reconcile Mach-O UUID observations without hiding malformed or conflicting sources. Require source-map identity digests to be supported by consistent observations. Keep truncated Android manifests as partial raw evidence, validate WABT section framing, and reject missing JEB inventories or error-marked success replies. Consolidate native UUID parsing and simplify capacity and malformed-input fixtures. Focused source and public workflow checks pass, including native arm64e inspection and real WABT framing probes; a successful real JEB GUI project opening remains unverified.
This commit is contained in:
@@ -138,6 +138,44 @@ it("accepts an unpadded DataCount row and still rejects malformed output and bad
|
||||
),
|
||||
).toThrow(/header/u);
|
||||
});
|
||||
it("bounds section header bytes while accepting a five-byte size LEB", () => {
|
||||
const paddedCustomDump = [
|
||||
"",
|
||||
"module.wasm:\tfile format wasm 0x1",
|
||||
"",
|
||||
"Sections:",
|
||||
"",
|
||||
' Custom start=0x0000000e end=0x0000000f (size=0x00000001) ""',
|
||||
"",
|
||||
"Section Details:",
|
||||
"",
|
||||
"Custom:",
|
||||
' - name: ""',
|
||||
"",
|
||||
].join("\n");
|
||||
expect(parseWabtOutput(paddedCustomDump, 15, [""]).sections).toMatchObject([
|
||||
{ kind: "Custom", start: 14, end: 15, bytes: 1 },
|
||||
]);
|
||||
|
||||
for (const gap of [0, 1, 7]) {
|
||||
const start = 11 + gap;
|
||||
const malformed = [
|
||||
"",
|
||||
"module.wasm:\tfile format wasm 0x1",
|
||||
"",
|
||||
"Sections:",
|
||||
"",
|
||||
" Type start=0x0000000a end=0x0000000b (size=0x00000001) count: 0",
|
||||
` Custom start=0x${start.toString(16).padStart(8, "0")} end=0x${(start + 1).toString(16).padStart(8, "0")} (size=0x00000001) "\"`,
|
||||
"",
|
||||
"Section Details:",
|
||||
"",
|
||||
].join("\n");
|
||||
expect(() => parseWabtOutput(malformed, start + 1, [""])).toThrow(
|
||||
/ranges/u,
|
||||
);
|
||||
}
|
||||
});
|
||||
it.each([
|
||||
{ displayed: [], decoded: ["named"] },
|
||||
{ displayed: ["named"], decoded: [] },
|
||||
|
||||
@@ -49,11 +49,12 @@ export const parseWabtOutput = (
|
||||
bytes: Number.parseInt(match[4] ?? "", 16),
|
||||
description,
|
||||
};
|
||||
const sectionHeaderBytes = section.start - (sections.at(-1)?.end ?? 8);
|
||||
if (
|
||||
section.end > artifactBytes ||
|
||||
section.end - section.start !== section.bytes ||
|
||||
section.start < 8 ||
|
||||
section.start < (sections.at(-1)?.end ?? 8)
|
||||
sectionHeaderBytes < 2 ||
|
||||
sectionHeaderBytes > 6
|
||||
)
|
||||
throw new Error("WABT section ranges do not match selected artifact.");
|
||||
sections.push(section);
|
||||
|
||||
Reference in New Issue
Block a user