Skip to content

Commit 1b579ce

Browse files
committed
[RTTI] Catch uncaught exceptions to let analysis finish in the event of an thrown exception
Probably should have done this sooner, just lets the user continue analysis, rtti exceptions are continuable from the view of analysis.
1 parent 7034625 commit 1b579ce

File tree

1 file changed

+41
-12
lines changed

1 file changed

+41
-12
lines changed

plugins/rtti/plugin.cpp

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,28 @@ void RTTIAnalysis(const Ref<AnalysisContext>& analysisContext)
2121
if (platformName.find("window") != std::string::npos)
2222
{
2323
// We currently only want to check for MSVC rtti on windows platforms
24-
auto processor = RTTI::Microsoft::MicrosoftRTTIProcessor(view);
24+
try
25+
{
26+
auto processor = RTTI::Microsoft::MicrosoftRTTIProcessor(view);
27+
processor.ProcessRTTI();
28+
view->StoreMetadata(VIEW_METADATA_RTTI, processor.SerializedMetadata(), true);
29+
}
30+
catch (std::exception& e)
31+
{
32+
LogErrorF("MSVC RTTI Analysis failed with uncaught exception: %s", e.what());
33+
}
34+
}
35+
36+
try
37+
{
38+
auto processor = RTTI::Itanium::ItaniumRTTIProcessor(view);
2539
processor.ProcessRTTI();
2640
view->StoreMetadata(VIEW_METADATA_RTTI, processor.SerializedMetadata(), true);
2741
}
28-
29-
auto processor = RTTI::Itanium::ItaniumRTTIProcessor(view);
30-
processor.ProcessRTTI();
31-
view->StoreMetadata(VIEW_METADATA_RTTI, processor.SerializedMetadata(), true);
42+
catch (std::exception& e)
43+
{
44+
LogErrorF("Itanium RTTI Analysis failed with uncaught exception: %s", e.what());
45+
}
3246
}
3347

3448

@@ -37,13 +51,28 @@ void VFTAnalysis(const Ref<AnalysisContext>& analysisContext)
3751
auto view = analysisContext->GetBinaryView();
3852
if (!MetadataExists(view))
3953
return;
40-
auto microsoftProcessor = RTTI::Microsoft::MicrosoftRTTIProcessor(view);
41-
microsoftProcessor.ProcessVFT();
42-
// TODO: We have to store the data for the second processor to pick up the info.
43-
view->StoreMetadata(VIEW_METADATA_RTTI, microsoftProcessor.SerializedMetadata(), true);
44-
auto itaniumProcessor = RTTI::Itanium::ItaniumRTTIProcessor(view);
45-
itaniumProcessor.ProcessVFT();
46-
view->StoreMetadata(VIEW_METADATA_RTTI, itaniumProcessor.SerializedMetadata(), true);
54+
try
55+
{
56+
auto microsoftProcessor = RTTI::Microsoft::MicrosoftRTTIProcessor(view);
57+
microsoftProcessor.ProcessVFT();
58+
// TODO: We have to store the data for the second processor to pick up the info.
59+
view->StoreMetadata(VIEW_METADATA_RTTI, microsoftProcessor.SerializedMetadata(), true);
60+
}
61+
catch (std::exception& e)
62+
{
63+
LogErrorF("MSVC VFT Analysis failed with uncaught exception: %s", e.what());
64+
}
65+
66+
try
67+
{
68+
auto itaniumProcessor = RTTI::Itanium::ItaniumRTTIProcessor(view);
69+
itaniumProcessor.ProcessVFT();
70+
view->StoreMetadata(VIEW_METADATA_RTTI, itaniumProcessor.SerializedMetadata(), true);
71+
}
72+
catch (std::exception& e)
73+
{
74+
LogErrorF("Itanium VFT Analysis failed with uncaught exception: %s", e.what());
75+
}
4776
}
4877

4978

0 commit comments

Comments
 (0)