Permalink
Browse files

ticket 3569: added further testcases

  • Loading branch information...
1 parent 7110fa2 commit c1e280217527d0f426738c34d2f7fb6d3abebdd1 Ettl Martin committed Jan 31, 2012
Showing with 32 additions and 0 deletions.
  1. +32 −0 test/testbufferoverrun.cpp
View
@@ -1363,6 +1363,38 @@ class TestBufferOverrun : public TestFixture {
" free(p);\n"
"}\n");
ASSERT_EQUALS("", errout.str());
+
+ check("void f()\n"
+ "{\n"
+ " char *p = new char[10];\n"
+ " p[0] = 0;\n"
+ " p[9] = 9;\n"
+ " delete [] p;\n"
+ "}\n");
+ ASSERT_EQUALS("", errout.str());
+
+ check("void f()\n"
+ "{\n"
+ " char *p(new char[10]);\n"
+ " p[0] = 0;\n"
+ " p[9] = 9;\n"
+ " delete [] p;\n"
+ "}\n");
+ ASSERT_EQUALS("", errout.str());
+
+ check("void f()\n"
+ "{\n"
+ " try{\n"
+ " char *p(new char[10]);\n"
+ " }\n"
+ " catch(...){\n"
+ " return;\n"
+ " }"
+ " p[0] = 0;\n"
+ " p[9] = 9;\n"
+ " delete [] p;\n"
+ "}\n");
+ ASSERT_EQUALS("", errout.str());
}
void array_index_multidim() {

0 comments on commit c1e2802

Please sign in to comment.