Buffer overruns: Added testcase for negative index when using 2-dimensional array

This commit is contained in:
Daniel Marjamäki 2010-04-18 21:07:21 +02:00
parent ecf556da7e
commit 8eff4fcbba
1 changed files with 7 additions and 0 deletions

View File

@ -1015,6 +1015,13 @@ private:
" data[-1] = 0;\n"
"}\n");
ASSERT_EQUALS("[test.cpp:4]: (error) Array index -1 corresponds with 4294967295, which is likely out of bounds\n", errout.str());
check("void f()\n"
"{\n"
" char data[8][4];\n"
" data[5][-1] = 0;\n"
"}\n");
ASSERT_EQUALS("[test.cpp:4]: (error) Array index -1 corresponds with 4294967295, which is likely out of bounds\n", errout.str());
}
void array_index_for_decr()