fix(flutter): reject ambiguous ELF mappings and bound note reads (#2334)

* fix(flutter): reject ambiguous mappings and bound ELF notes

Resolve PT_LOAD interpretations once for symbols and dynamic tables, including partial overlaps. Preserve equivalent mappings and leave conflicting or invalid alternate definitions unresolved.

Bound distinct nonempty ELF note ranges before retention and reads, deduplicate shared ranges, preserve observed build-ID candidates and report partial coverage on exhaustion. Correct shared verifier workspace ownership and structured Windows path assertions.

Addresses the two post-merge review findings on PR #1582. Validation: 147 focused cases across Linux, macOS Sonoma 14.8.9 and non-administrator Windows 11 build 26300.9457; real Gallery CLI/MCP checks on all three hosts; six compiler-produced ELF32/ELF64 hash-layout cases; static, docs, discovery and duplication checks. Full string-pool projections remain explicitly bounded.

* test(flutter): parse complete facts through named result schemas

---------

Co-authored-by: me <me@medz.org>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
This commit is contained in:
Quentin Limo
2026-10-13 22:13:22 +08:00
committed by GitHub
co-authored by me morluto
parent fd65e278be
commit e3a012d6c9
10 changed files with 510 additions and 68 deletions
+16 -14
View File
@@ -1,12 +1,12 @@
import assert from "node:assert/strict";
import { execFile } from "node:child_process";
import { readdir, readFile } from "node:fs/promises";
import { resolve } from "node:path";
import { mkdtemp, readdir, readFile, rm } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join, resolve } from "node:path";
import { promisify } from "node:util";
import { Client } from "@modelcontextprotocol/client";
import { StdioClientTransport } from "@modelcontextprotocol/client/stdio";
import { toolContract } from "../dist/contracts/toolContracts.js";
import { PrivateRuntimeRoot } from "../dist/process/PrivateRuntimeRoot.js";
import { hashStableFile } from "../dist/filesystem/StableFileHash.js";
import { mcpTextValue } from "./lib/mcp-verifier-results.mjs";
@@ -27,17 +27,16 @@ const expectations =
options.expectations === null
? null
: JSON.parse(await readFile(options.expectations, "utf8"));
const root = await PrivateRuntimeRoot.create({
prefix: "rea-flutter-verifier-",
});
// This is a shared test parent, not a leased provider-owned Windows runtime.
const root = await mkdtemp(join(tmpdir(), "rea-flutter-verifier-"));
const entrypoint = resolve("scripts/rea.mjs");
const environment = Object.fromEntries(
Object.entries(process.env).filter(([, value]) => typeof value === "string"),
);
Object.assign(environment, {
TMPDIR: root.path,
TMP: root.path,
TEMP: root.path,
TMPDIR: root,
TMP: root,
TEMP: root,
});
const client = new Client({ name: "flutter-verifier", version: "1" });
const transport = new StdioClientTransport({
@@ -190,15 +189,18 @@ try {
} finally {
// Server shutdown retries retained provider cleanup and must settle before success.
try {
await client.close();
await transport.close();
try {
await client.close();
} finally {
await transport.close();
}
assert.deepEqual(
await readdir(root.path),
await readdir(root),
[],
"Provider snapshots must be released before verification succeeds",
`Provider snapshots remain under ${root}`,
);
} finally {
await root.close();
await rm(root, { recursive: true, force: true });
}
}
process.stdout.write(