From 12b6cf8c70ceb1950939254d7c639418002b97a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Wed, 28 Jan 2009 05:31:26 +0000 Subject: [PATCH] bad sizeof handling --- test/testbufferoverrun.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/testbufferoverrun.cpp b/test/testbufferoverrun.cpp index 237e556a8..f7850a4e2 100644 --- a/test/testbufferoverrun.cpp +++ b/test/testbufferoverrun.cpp @@ -67,6 +67,8 @@ private: TEST_CASE(noerr2); TEST_CASE(noerr3); TEST_CASE(noerr4); + + TEST_CASE(sizeof1); TEST_CASE(array_index_1); TEST_CASE(array_index_2); @@ -157,6 +159,21 @@ private: } + + + void sizeof1() + { + check("static void f()\n" + "{\n" + " char data[10];\n" + " data[ sizeof(*data) ] = 0;\n" + "}\n"); + ASSERT_EQUALS(std::string(""), errout.str()); + } + + + + void array_index_1() { check("void f()\n"