summaryrefslogtreecommitdiff
path: root/view/sharedcache/core/SlideInfo.cpp
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-04-02 14:42:10 -0400
committerMason Reed <mason@vector35.com>2025-04-02 14:42:10 -0400
commit49ea03c417168a707125169b77e6ff1c7ebbe097 (patch)
tree49b4a413f43c84fdf866215e37276942cdcb2299 /view/sharedcache/core/SlideInfo.cpp
parente2ee6a396a9ff0f6a850b9a648d828a92a73e64e (diff)
[SharedCache] Fix old slide info mapping format not getting the mapped address for the file offset
This would result in the virtual memory trying to access an unmapped region, failing to apply slide info
Diffstat (limited to 'view/sharedcache/core/SlideInfo.cpp')
-rw-r--r--view/sharedcache/core/SlideInfo.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/view/sharedcache/core/SlideInfo.cpp b/view/sharedcache/core/SlideInfo.cpp
index e258a90c..3ab83d33 100644
--- a/view/sharedcache/core/SlideInfo.cpp
+++ b/view/sharedcache/core/SlideInfo.cpp
@@ -16,12 +16,6 @@ void ApplySlideInfoV5(VirtualMemory& vm, const SlideMappingInfo& mapping)
uint64_t pageStartCount = mapping.slideInfoV5.page_starts_count;
uint64_t pageSize = mapping.slideInfoV5.page_size;
- uint64_t offset;
- // Retrieve this once so we don't need to keep querying the region through the VM.
- auto region = vm.GetRegionAtAddress(mapping.address, offset);
- if (!region.has_value())
- throw UnmappedRegionException(mapping.address);
-
auto cursor = pageStartsOffset;
for (size_t i = 0; i < pageStartCount; i++)
{
@@ -198,6 +192,10 @@ std::vector<SlideMappingInfo> SlideInfoProcessor::ReadEntryInfo(VirtualMemory& v
else if (singleMapping.slideInfoVersion == 3)
vm.Read(&singleMapping.slideInfoV3, *slideInfoAddress, sizeof(dyld_cache_slide_info_v3));
+ // Adjust the file offset to mapped, we are expecting the consumer to just take it in as mapped.
+ // if we did not make it mapped, then we would need to do all this weirdness in every consumer (each slide info version)
+ singleMapping.mappingInfo.fileOffset = *entry.GetMappedAddress(singleMapping.mappingInfo.fileOffset);
+
return {singleMapping};
}