diff options
| author | WeiN76LQh <WeiN76LQh@github.com> | 2024-12-29 13:45:27 +0000 |
|---|---|---|
| committer | kat <kat@vector35.com> | 2025-01-08 15:09:07 -0500 |
| commit | faac469f6fb026ebd91e6b93169046bdd2bae320 (patch) | |
| tree | 9c3752aa3d1b1b4a4654e4a11e472e4e3ed8229e /view/sharedcache/core/SharedCache.cpp | |
| parent | b34393c33a82050dcb5e65d5fc7d36960c18e167 (diff) | |
[SharedCache] Fix uninitialized `loaded` field for mappings returned by `BNDSCViewGetAllImages`
Diffstat (limited to 'view/sharedcache/core/SharedCache.cpp')
| -rw-r--r-- | view/sharedcache/core/SharedCache.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/view/sharedcache/core/SharedCache.cpp b/view/sharedcache/core/SharedCache.cpp index 51e95bc6..d45785e8 100644 --- a/view/sharedcache/core/SharedCache.cpp +++ b/view/sharedcache/core/SharedCache.cpp @@ -3059,6 +3059,11 @@ std::vector<MemoryRegion> SharedCache::GetMappedRegions() const return State().regionsMappedIntoMemory; } +bool SharedCache::IsMemoryMapped(uint64_t address) +{ + return m_dscView->IsValidOffset(address); +} + extern "C" { BNSharedCache* BNGetSharedCache(BNBinaryView* data) @@ -3322,11 +3327,13 @@ extern "C" images[i].mappings = (BNDSCImageMemoryMapping*)malloc(sizeof(BNDSCImageMemoryMapping) * header.sections.size()); for (size_t j = 0; j < header.sections.size(); j++) { + const auto sectionStart = header.sections[j].addr; images[i].mappings[j].rawViewOffset = header.sections[j].offset; - images[i].mappings[j].vmAddress = header.sections[j].addr; + images[i].mappings[j].vmAddress = sectionStart; images[i].mappings[j].size = header.sections[j].size; images[i].mappings[j].name = BNAllocString(header.sectionNames[j].c_str()); - images[i].mappings[j].filePath = BNAllocString(vm->MappingAtAddress(header.sections[j].addr).first.filePath.c_str()); + images[i].mappings[j].filePath = BNAllocString(vm->MappingAtAddress(sectionStart).first.filePath.c_str()); + images[i].mappings[j].loaded = cache->object->IsMemoryMapped(sectionStart); } i++; } |
