summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libs/cplusplus/pp-engine.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp
index 3ef5e2c38e..5ee8298a72 100644
--- a/src/libs/cplusplus/pp-engine.cpp
+++ b/src/libs/cplusplus/pp-engine.cpp
@@ -76,6 +76,7 @@ using namespace Utils;
namespace {
enum {
+ MAX_FUNCTION_LIKE_ARGUMENTS_COUNT = 100,
MAX_TOKEN_EXPANSION_COUNT = 5000,
MAX_TOKEN_BUFFER_DEPTH = 16000 // for when macros are using some kind of right-folding, this is the list of "delayed" buffers waiting to be expanded after the current one.
};
@@ -1058,6 +1059,9 @@ bool Preprocessor::handleIdentifier(PPToken *tk)
argRefs);
}
+ if (allArgTks.size() > MAX_FUNCTION_LIKE_ARGUMENTS_COUNT)
+ return false;
+
if (!handleFunctionLikeMacro(macro, body, allArgTks, baseLine)) {
if (m_client && !idTk.expanded())
m_client->stopExpandingMacro(idTk.byteOffset, *macro);