From 3e9f6daa00831573c1de80b08ab474ca5cc91bb7 Mon Sep 17 00:00:00 2001 From: Alexander Mai Date: Mon, 29 Jul 2013 10:57:41 +0200 Subject: [PATCH] Added test cases for #4801 (Cppcheck fails to parse Posix (crash in CheckOther::checkPipeParameterSize())) --- test/testother.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/testother.cpp b/test/testother.cpp index 766b01655..f0bc397c5 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -6097,6 +6097,23 @@ private: "}\n"); ASSERT_EQUALS("", errout.str()); + // avoid crash with pointer variable - for local variable on stack as well - see #4801 + check("void foo {\n" + " int *cp;\n" + " if ( pipe (cp) == -1 ) {\n" + " return;\n" + " }\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); + + // test with unknown variable + check("void foo {\n" + " if ( pipe (cp) == -1 ) {\n" + " return;\n" + " }\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); + } void checkCastIntToCharAndBack() { // #160