diff options
author | Stephen Kelly <steveire@gmail.com> | 2014-05-11 14:04:53 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2014-07-01 22:09:38 (GMT) |
commit | 61ce6547424821710d0fbebf06b0eb411a630253 (patch) | |
tree | 157f3f2e3a30bdbda660a91c6c751f3dad7c1957 /Source/cmGeneratorExpressionEvaluator.cxx | |
parent | bf5fc1d5829e7995c0941996b4a515cbd46d4e4e (diff) | |
download | CMake-61ce6547424821710d0fbebf06b0eb411a630253.zip CMake-61ce6547424821710d0fbebf06b0eb411a630253.tar.gz CMake-61ce6547424821710d0fbebf06b0eb411a630253.tar.bz2 |
Genex: Fix stack overflow in transitive property evaluation.
Commit v2.8.11~156^2~2 (Expand includes and defines transitively
in 'external' genexes., 2013-02-13) introduced a recursive loop
and a stack overflow during evaluation of a link implementation
which depends on a transitive property, such as
add_library(empty1 ...)
add_library(empty2 ...)
target_link_libraries(empty1
PRIVATE
$<$<STREQUAL:$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>,/foo/bar>:empty2>
)
There is no use-case for code like that currently, but it should not
cause a stack overflow.
Avoid the recursion by reporting an error early if a case like this
is found.
Diffstat (limited to 'Source/cmGeneratorExpressionEvaluator.cxx')
-rw-r--r-- | Source/cmGeneratorExpressionEvaluator.cxx | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index c925869..b648eb2 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -1028,6 +1028,19 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode { if (dagCheckerParent->EvaluatingLinkLibraries()) { +#define TRANSITIVE_PROPERTY_COMPARE(PROPERTY) \ + (#PROPERTY == propertyName || "INTERFACE_" #PROPERTY == propertyName) || + if (CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME(TRANSITIVE_PROPERTY_COMPARE) + false) + { + reportError(context, content->GetOriginalExpression(), + "$<TARGET_PROPERTY:...> expression in link libraries " + "evaluation depends on target property which is transitive " + "over the link libraries, creating a recursion."); + return std::string(); + } +#undef TRANSITIVE_PROPERTY_COMPARE + if(!prop) { return std::string(); |