diff options
| author | Mason Reed <mason@vector35.com> | 2025-02-25 19:13:50 -0500 |
|---|---|---|
| committer | Mason Reed <mason@vector35.com> | 2025-04-02 05:36:54 -0400 |
| commit | c1cf836de9ae7ec55a131f2ca48756a4a4e9a447 (patch) | |
| tree | 81d00905122fa0c7cf9668bff556d6a907f9f7b1 /view/sharedcache | |
| parent | c5013da759f54aefe4229724b1224fff349aab6d (diff) | |
[SharedCache] Stop crashing if we don't have a valid dyld in PerformInitialLoad
Still need to decide on how we want handle this, because we need multiple files we probably just want to prompt the user for a directory?
Diffstat (limited to 'view/sharedcache')
| -rw-r--r-- | view/sharedcache/core/SharedCache.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/view/sharedcache/core/SharedCache.cpp b/view/sharedcache/core/SharedCache.cpp index 25391dc2..a696e9b3 100644 --- a/view/sharedcache/core/SharedCache.cpp +++ b/view/sharedcache/core/SharedCache.cpp @@ -472,12 +472,14 @@ void SharedCache::PerformInitialLoad(std::lock_guard<std::mutex>& lock) initialState.baseFilePath = path; initialState.cacheFormat = RegularCacheFormat; + // TODO: If this fails we should prompt the user to select there file, this probably means that + // TODO: They are opening a database with no original file path. DataBuffer sig = baseFile->ReadBuffer(0, 4); if (sig.GetLength() != 4) - abort(); + throw std::runtime_error("Not a valid dyld_shared_cache file"); const char* magic = (char*)sig.GetData(); if (strncmp(magic, "dyld", 4) != 0) - abort(); + throw std::runtime_error("Not a valid dyld_shared_cache file"); dyld_cache_header primaryCacheHeader {}; size_t header_size = baseFile->ReadUInt32(16); @@ -1469,9 +1471,9 @@ SharedCache::SharedCache(BinaryNinja::Ref<BinaryNinja::BinaryView> dscView) : try { PerformInitialLoad(lock); } - catch (...) + catch (std::exception& e) { - m_logger->LogError("Failed to perform initial load of Shared Cache"); + m_logger->LogError("Failed to perform initial load of Shared Cache: %s", e.what()); } auto settings = m_dscView->GetLoadSettings(VIEW_NAME); |
