fix(apple): harden dyld cache reads, mappings, and resolution findings

This commit is contained in:
morluto committed 2026-10-08 15:36:31 +08:00
1 parent cd622e0e95
commit d081ffbdce
8 files changed
+138 -20

No files matched your search

@@ -108,12 +108,17 @@ export const inspectDyldSharedCache = async (
const unreadable = cache.header.subcaches
.filter(({ status }) => status !== "present")
.map(({ suffix }) => suffix);
// Hash through the open handles the header was parsed from, so a path
// replacement mid-inspection cannot attribute new bytes to old facts.
const mainSha = await cache.mainSha256(signal);
const subcacheSha = await cache.subcacheSha256(signal);
return ok(
dyldSharedCacheResultSchema.parse({
cache_path: cachePath,
// The header and image list were read through this same handle.
main_file_sha256: await cache.mainSha256(signal),
main_file_sha256: mainSha,
...cache.header,
subcache_sha256: subcacheSha,
images_total: cache.images.length,
images: cache.images.map(({ path, address }) => ({
path,