From 3abb62a6d18f8f771d4ced17c4e28a53f78e54e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 20 Aug 2017 19:47:26 +0200 Subject: [PATCH] Fixed #8036 (valueFlowUninit: strcpy(buf, e = str), free(e);) --- lib/valueflow.cpp | 2 +- test/testvalueflow.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index 6daa4ad75..3778bbff1 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -1680,7 +1680,7 @@ static bool valueFlowForward(Token * const startToken, std::list::const_iterator it; for (it = values.begin(); it != values.end(); ++it) setTokenValue(tok3, *it, settings); - } else if (Token::Match(tok3, "++|--|?|:|;")) + } else if (Token::Match(tok3, "++|--|?|:|;|,")) break; // Skip sizeof etc else if (Token::Match(tok3, "sizeof|typeof|typeid (")) diff --git a/test/testvalueflow.cpp b/test/testvalueflow.cpp index aaacfcb56..8b2b1fc1c 100644 --- a/test/testvalueflow.cpp +++ b/test/testvalueflow.cpp @@ -2530,6 +2530,13 @@ private: " x = dostuff(sizeof(*x)*y);\n" "}"; ASSERT_EQUALS(0U, tokenValues(code, "x )").size()); + + // #8036 + code = "void foo() {\n" + " int x;\n" + " f(x=3), return x+3;\n" + "}"; + ASSERT_EQUALS(0U, tokenValues(code, "x +").size()); } };