From 9f322137f83938672b9f1e2c4e851e2c94894161 Mon Sep 17 00:00:00 2001 From: WeiN76LQh Date: Thu, 27 Feb 2025 01:03:07 +0000 Subject: [PATCH] [SharedCache] Limit sections being added in `SharedCache::InitializeHeader` to the regions being loaded The logic before would default to adding a section unless it was from a region in the `regionsToLoad` argument and its header had already been initialized. However if a user does `Load Section by Address` then there's only one region in `regionsToLoad`. All sections not in that region would be automatically added, even if they had already been or the user hadn't requested them to be loaded. --- view/sharedcache/core/SharedCache.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/view/sharedcache/core/SharedCache.cpp b/view/sharedcache/core/SharedCache.cpp index e3c115cd0..9e5783849 100644 --- a/view/sharedcache/core/SharedCache.cpp +++ b/view/sharedcache/core/SharedCache.cpp @@ -2424,13 +2424,13 @@ void SharedCache::InitializeHeader( for (size_t i = 0; i < header.sections.size(); i++) { - bool skip = false; + bool skip = true; for (const auto& region : regionsToLoad) { if (header.sections[i].addr >= region->start && header.sections[i].addr < region->start + region->size) { - if (MemoryRegionIsHeaderInitialized(lock, *region)) - skip = true; + if (!MemoryRegionIsHeaderInitialized(lock, *region)) + skip = false; break; } }