From ba777b54d1c9a48103b7f737704e3a226151f10c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6neberg?= Date: Wed, 20 Oct 2021 20:41:42 +0200 Subject: [PATCH] prevent uncaught exception in ThreadExecutor::handleRead() (#3514) --- cli/threadexecutor.cpp | 7 ++++++- lib/checkcondition.cpp | 2 +- lib/symboldatabase.cpp | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cli/threadexecutor.cpp b/cli/threadexecutor.cpp index 7d4982ae8..99e7c3c1e 100644 --- a/cli/threadexecutor.cpp +++ b/cli/threadexecutor.cpp @@ -121,7 +121,12 @@ int ThreadExecutor::handleRead(int rpipe, unsigned int &result) mErrorLogger.reportOut(buf); } else if (type == REPORT_ERROR || type == REPORT_INFO) { ErrorMessage msg; - msg.deserialize(buf); + try { + msg.deserialize(buf); + } catch (const InternalError& e) { + std::cerr << "#### ThreadExecutor::handleRead error, internal error:" << e.errorMessage << std::endl; + std::exit(EXIT_FAILURE); + } if (!mSettings.nomsg.isSuppressed(msg.toSuppressionsErrorMessage())) { // Alert only about unique errors diff --git a/lib/checkcondition.cpp b/lib/checkcondition.cpp index e160cf53a..1cd98039a 100644 --- a/lib/checkcondition.cpp +++ b/lib/checkcondition.cpp @@ -1803,7 +1803,7 @@ void CheckCondition::checkCompareValueOutOfTypeRange() break; default: break; - }; + } if (bits == 0 || bits >= 64) continue; diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index fd68673bd..14c7eac53 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -998,7 +998,7 @@ void SymbolDatabase::createSymbolDatabaseVariableSymbolTable() void SymbolDatabase::createSymbolDatabaseSetScopePointers() { - auto setScopePointers = [this](const Scope &scope, const Token *bodyStart, const Token *bodyEnd) { + auto setScopePointers = [](const Scope &scope, const Token *bodyStart, const Token *bodyEnd) { assert(bodyStart); assert(bodyEnd);