From 572ae0c1b4389ade7ee6296119dc1499e4708a97 Mon Sep 17 00:00:00 2001 From: Martin Ettl Date: Fri, 23 Apr 2010 21:56:35 +0200 Subject: [PATCH] added todo testcases for multidimensional out of bounds checking --- test/testbufferoverrun.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/testbufferoverrun.cpp b/test/testbufferoverrun.cpp index 9b5598f44..3f06b3748 100755 --- a/test/testbufferoverrun.cpp +++ b/test/testbufferoverrun.cpp @@ -951,6 +951,24 @@ private: " a[1][1][2] = 'a';\n" "}\n"); ASSERT_EQUALS("[test.cpp:4]: (error) Array 'a[2][2][2]' index a[1][1][2] out of bounds\n", errout.str()); + + check("void f()\n" + "{\n" + " char a[10][10][10];\n" + " a[2*3][4*3][2] = 'a';\n" + "}\n"); + TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Array 'a[10][10][10]' index a[6][12][2] out of bounds\n", errout.str()); + + check("void f()\n" + "{\n" + " int i=2;\n" + " int ii=10;\n" + " char a[ii][ii][ii];\n" + " a[i*3][4*ii][ii] = 'a';\n" + "}\n"); + TODO_ASSERT_EQUALS("[test.cpp:4]: (error) Array 'a[10][10][10]' index a[6][40][10] out of bounds\n", errout.str()); + + } void array_index_switch_in_for()