From 1b579ce8166b960533e098e37a4f076ca5a8fe02 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Thu, 22 May 2025 12:44:59 +0200 Subject: [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. --- plugins/rtti/plugin.cpp | 53 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 12 deletions(-) (limited to 'plugins/rtti/plugin.cpp') diff --git a/plugins/rtti/plugin.cpp b/plugins/rtti/plugin.cpp index b3a5b413..2cf4b973 100644 --- a/plugins/rtti/plugin.cpp +++ b/plugins/rtti/plugin.cpp @@ -21,14 +21,28 @@ void RTTIAnalysis(const Ref& analysisContext) if (platformName.find("window") != std::string::npos) { // We currently only want to check for MSVC rtti on windows platforms - auto processor = RTTI::Microsoft::MicrosoftRTTIProcessor(view); + try + { + auto processor = RTTI::Microsoft::MicrosoftRTTIProcessor(view); + processor.ProcessRTTI(); + view->StoreMetadata(VIEW_METADATA_RTTI, processor.SerializedMetadata(), true); + } + catch (std::exception& e) + { + LogErrorF("MSVC RTTI Analysis failed with uncaught exception: %s", e.what()); + } + } + + try + { + auto processor = RTTI::Itanium::ItaniumRTTIProcessor(view); processor.ProcessRTTI(); view->StoreMetadata(VIEW_METADATA_RTTI, processor.SerializedMetadata(), true); } - - auto processor = RTTI::Itanium::ItaniumRTTIProcessor(view); - processor.ProcessRTTI(); - view->StoreMetadata(VIEW_METADATA_RTTI, processor.SerializedMetadata(), true); + catch (std::exception& e) + { + LogErrorF("Itanium RTTI Analysis failed with uncaught exception: %s", e.what()); + } } @@ -37,13 +51,28 @@ void VFTAnalysis(const Ref& analysisContext) auto view = analysisContext->GetBinaryView(); if (!MetadataExists(view)) return; - auto microsoftProcessor = RTTI::Microsoft::MicrosoftRTTIProcessor(view); - microsoftProcessor.ProcessVFT(); - // TODO: We have to store the data for the second processor to pick up the info. - view->StoreMetadata(VIEW_METADATA_RTTI, microsoftProcessor.SerializedMetadata(), true); - auto itaniumProcessor = RTTI::Itanium::ItaniumRTTIProcessor(view); - itaniumProcessor.ProcessVFT(); - view->StoreMetadata(VIEW_METADATA_RTTI, itaniumProcessor.SerializedMetadata(), true); + try + { + auto microsoftProcessor = RTTI::Microsoft::MicrosoftRTTIProcessor(view); + microsoftProcessor.ProcessVFT(); + // TODO: We have to store the data for the second processor to pick up the info. + view->StoreMetadata(VIEW_METADATA_RTTI, microsoftProcessor.SerializedMetadata(), true); + } + catch (std::exception& e) + { + LogErrorF("MSVC VFT Analysis failed with uncaught exception: %s", e.what()); + } + + try + { + auto itaniumProcessor = RTTI::Itanium::ItaniumRTTIProcessor(view); + itaniumProcessor.ProcessVFT(); + view->StoreMetadata(VIEW_METADATA_RTTI, itaniumProcessor.SerializedMetadata(), true); + } + catch (std::exception& e) + { + LogErrorF("Itanium VFT Analysis failed with uncaught exception: %s", e.what()); + } } -- cgit v1.3.1