mirror of
https://github.com/morluto/rea.git
synced 2026-11-20 05:32:44 +00:00
fix(elf): preserve truncated kernel config evidence at the inflate limit (#12653)
This commit is contained in:
1 parent
e6ebfbecde
commit
484bdc183a
2 files changed
+26
No files matched your search
@@ -450,6 +450,12 @@ const findConfig = async (
|
||||
const limit = Math.min(maxOutput, remaining);
|
||||
const member = await inflateGzipMember(bytes, gzipAt, limit, signal);
|
||||
if (member.kind === "limit") {
|
||||
// Without an end marker, the stopped inflate cannot establish an
|
||||
// oversized config. No later candidate can be framed either.
|
||||
if (closing < 0) {
|
||||
truncated = true;
|
||||
break;
|
||||
}
|
||||
if (limit < maxOutput) return "exhausted";
|
||||
// A member past max_config_bytes may be a decoy, so a later framed
|
||||
// config can still win; the budget failure is raised only if none does.
|
||||
|
||||
@@ -71,6 +71,26 @@ describe("kernel build config stable filesystem boundary", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("retains partial framing evidence under the config inflate limit", async () => {
|
||||
const root = await createTestTempDirectory("rea-kernel-config-framing-");
|
||||
const path = join(root, "vmlinux");
|
||||
await writeFile(path, kernelBuildConfigFixture().subarray(0, -1));
|
||||
const service = createKernelBuildConfigService();
|
||||
try {
|
||||
for (const max_config_bytes of [4096, 64]) {
|
||||
const result = await service.inspect({ path, max_config_bytes });
|
||||
if (!result.ok) throw result.error;
|
||||
expect(result.value.normalized_result).toMatchObject({
|
||||
banner: { status: "present", version: "6.6.0" },
|
||||
config: { status: "incomplete", reason: "config_gzip_truncated" },
|
||||
coverage: { status: "partial" },
|
||||
});
|
||||
}
|
||||
} finally {
|
||||
await service.close();
|
||||
}
|
||||
});
|
||||
|
||||
it("reports an ordinary IKCFG_ST string as no config with file Evidence", async () => {
|
||||
const root = await createTestTempDirectory("rea-kernel-config-plain-");
|
||||
const path = join(root, "vmlinux");
|
||||
|
||||
Reference in new issue
Block a user