summaryrefslogtreecommitdiff
path: root/view/sharedcache
diff options
context:
space:
mode:
authorkat <kat@vector35.com>2024-10-29 09:47:29 -0400
committerkat <kat@vector35.com>2024-11-05 09:03:01 -0500
commitfd8eb478a7a3bbc848da37bd33e62c2d8cf26b99 (patch)
tree8cff21d73a322aa11003d95bb88c7c9f3127482e /view/sharedcache
parent453da7f33d3feb3b3079de9274219f80e3d34109 (diff)
[SharedCache] Fix a crash whenever user uses DSC apis on non-dsc.
Diffstat (limited to 'view/sharedcache')
-rw-r--r--view/sharedcache/core/SharedCache.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/view/sharedcache/core/SharedCache.cpp b/view/sharedcache/core/SharedCache.cpp
index a597cfb5..49aa3174 100644
--- a/view/sharedcache/core/SharedCache.cpp
+++ b/view/sharedcache/core/SharedCache.cpp
@@ -1333,6 +1333,12 @@ void SharedCache::ParseAndApplySlideInfoForFile(std::shared_ptr<MMappedFileAcces
SharedCache::SharedCache(BinaryNinja::Ref<BinaryNinja::BinaryView> dscView) : m_dscView(dscView)
{
+ if (dscView->GetTypeName() != VIEW_NAME)
+ {
+ // Unreachable?
+ m_logger->LogError("Attempted to create SharedCache object from non-Shared Cache view");
+ return;
+ }
sharedCacheReferences++;
INIT_SHAREDCACHE_API_OBJECT()
m_logger = LogRegistry::GetLogger("SharedCache", dscView->GetFile()->GetSessionId());
@@ -1381,6 +1387,8 @@ SharedCache::~SharedCache() {
SharedCache* SharedCache::GetFromDSCView(BinaryNinja::Ref<BinaryNinja::BinaryView> dscView)
{
+ if (dscView->GetTypeName() != VIEW_NAME)
+ return nullptr;
try {
return new SharedCache(dscView);
}