summaryrefslogtreecommitdiff
path: root/view/sharedcache/core/DSCView.cpp
diff options
context:
space:
mode:
authorkat <kat@vector35.com>2024-11-13 15:26:37 -0500
committerkat <kat@vector35.com>2024-11-13 16:18:10 -0500
commit6bd0f078c302ff641c01767be01d9f20445521ab (patch)
tree551df6c34678f2766d7329430d422880fa1d686a /view/sharedcache/core/DSCView.cpp
parentd553396c16a1f356f35f383d7838df8b4d8717b5 (diff)
[SharedCache] Fix a bndb deserialization error caused by last commit
Diffstat (limited to 'view/sharedcache/core/DSCView.cpp')
-rw-r--r--view/sharedcache/core/DSCView.cpp50
1 files changed, 9 insertions, 41 deletions
diff --git a/view/sharedcache/core/DSCView.cpp b/view/sharedcache/core/DSCView.cpp
index 06a73a69..31af3bd7 100644
--- a/view/sharedcache/core/DSCView.cpp
+++ b/view/sharedcache/core/DSCView.cpp
@@ -662,27 +662,18 @@ bool DSCView::Init()
}
std::vector<std::pair<uint64_t, std::vector<std::pair<uint64_t, std::pair<BNSymbolType, std::string>>>>> exportInfos;
- for (auto& exportInfo : result["exportInfos"].GetArray())
- {
- std::vector<std::pair<uint64_t, std::pair<BNSymbolType, std::string>>> exportInfoVec;
- for (auto& exportInfoPair : exportInfo.GetArray())
- {
- exportInfoVec.push_back({exportInfoPair[0].GetUint64(), { (BNSymbolType)exportInfoPair[1].GetUint(), exportInfoPair[2].GetString()}});
- }
- exportInfos.push_back({exportInfo[0].GetUint64(), exportInfoVec});
- }
- std::vector<std::pair<uint64_t, std::vector<std::pair<uint64_t, std::pair<BNSymbolType, std::string>>>>> symbolInfos;
- for (auto& symbolInfo : result["symbolInfos"].GetArray())
+ for (const auto& obj1 : result["exportInfos"].GetArray())
{
- std::vector<std::pair<uint64_t, std::pair<BNSymbolType, std::string>>> symbolInfoVec;
- for (auto& symbolInfoPair : symbolInfo.GetArray())
+ std::vector<std::pair<uint64_t, std::pair<BNSymbolType, std::string>>> innerVec;
+ for (const auto& obj2 : obj1["value"].GetArray())
{
- symbolInfoVec.push_back({symbolInfoPair[0].GetUint64(), { (BNSymbolType)symbolInfoPair[1].GetUint(), symbolInfoPair[2].GetString()}});
+ std::pair<BNSymbolType, std::string> innerPair = { (BNSymbolType)obj2["val1"].GetUint64(), obj2["val2"].GetString() };
+ innerVec.push_back({ obj2["key"].GetUint64(), innerPair });
}
- symbolInfos.push_back({symbolInfo[0].GetUint64(), symbolInfoVec});
- }
+ exportInfos.push_back({obj1["key"].GetUint64(), innerVec});
+ }
// We need to re-map data located in the Raw (parent parent) viewtype to the DSCRaw (parent) viewtype.
for (auto region : regionsMappedIntoMemory)
{
@@ -693,31 +684,6 @@ bool DSCView::Init()
}
BeginBulkModifySymbols();
- for (const auto & [imageBaseAddr, symbolList] : symbolInfos)
- {
- std::vector<Ref<Symbol>> symbolsList;
- for (const auto & [symAddr, symTypeAndName] : symbolList)
- {
- symbolsList.push_back(new Symbol(symTypeAndName.first, symTypeAndName.second, symAddr));
- }
-
- auto typelib = GetTypeLibrary(imageStartToInstallName[imageBaseAddr]);
-
- for (const auto& symbol : symbolsList)
- {
- if (typelib)
- {
- auto type = typelib->GetNamedObject(symbol->GetRawName());
- if (type)
- {
- DefineAutoSymbolAndVariableOrFunction(GetDefaultPlatform(), symbol, type);
- continue;
- }
- }
- DefineAutoSymbol(symbol);
- }
- }
-
for (const auto & [imageBaseAddr, exportList] : exportInfos)
{
std::vector<Ref<Symbol>> symbolsList;
@@ -730,6 +696,8 @@ bool DSCView::Init()
for (const auto& symbol : symbolsList)
{
+ if (!IsValidOffset(symbol->GetAddress()))
+ continue;
if (typelib)
{
auto type = typelib->GetNamedObject(symbol->GetRawName());