summaryrefslogtreecommitdiff
path: root/view/sharedcache/core/SharedCache.cpp
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-04-14 15:10:31 -0400
committerMason Reed <mason@vector35.com>2025-04-14 15:10:31 -0400
commit4f7d5e40861d73a3738b63f92d9ff5feb235f8d6 (patch)
treea371552fcf77671e91cc130fadfab57e57e25ad7 /view/sharedcache/core/SharedCache.cpp
parent507935f828188047ee009d2216a2c2d92c8b83fd (diff)
[SharedCache] Fix overzealous alert about missing shared cache entries
Following the conversation in https://github.com/Vector35/binaryninja-api/issues/6631 we are going to make the edited alerts warnings and then also fix the warning showing on certain shared caches even when all entries are present.
Diffstat (limited to 'view/sharedcache/core/SharedCache.cpp')
-rw-r--r--view/sharedcache/core/SharedCache.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/view/sharedcache/core/SharedCache.cpp b/view/sharedcache/core/SharedCache.cpp
index 2eb885d4..4950c8c0 100644
--- a/view/sharedcache/core/SharedCache.cpp
+++ b/view/sharedcache/core/SharedCache.cpp
@@ -59,12 +59,10 @@ CacheEntry CacheEntry::FromFile(const std::string& filePath, const std::string&
// Read the header, this _should_ be compatible with all known DSC formats.
// Mason: the above is not true! https://github.com/Vector35/binaryninja-api/issues/6073
+ // The mappingOffset should point right after the header. We use this to constrain the read size so unsupported fields are zeroed.
+ auto headerSize = file->ReadUInt32(0x10);
dyld_cache_header header = {};
- file->Read(&header, 0, sizeof(header));
-
- // Adjust the array count to actually be the "real" number for comparisons with what we load.
- // This is required so we can check if we loaded the required number of caches, in view init.
- header.subCacheArrayCount += header.cacheSubType;
+ file->Read(&header, 0, headerSize);
// Read the mappings using the headers `mappingCount` and `mappingOffset`.
dyld_cache_mapping_info currentMapping = {};