Preprocessor: Test handling of strings with multiple spaces (Ticket: #2548)

This commit is contained in:
Erik Lax 2011-02-11 18:57:58 +01:00 committed by Daniel Marjamäki
parent f2f2d1f885
commit c7821675dd
1 changed files with 10 additions and 0 deletions

View File

@ -133,6 +133,7 @@ private:
TEST_CASE(buffer_overrun_14);
TEST_CASE(buffer_overrun_15); // ticket #1787
TEST_CASE(buffer_overrun_16);
TEST_CASE(buffer_overrun_17); // ticket #2548
TEST_CASE(buffer_overrun_bailoutIfSwitch); // ticket #2378 : bailoutIfSwitch
// It is undefined behaviour to point out of bounds of an array
@ -1860,6 +1861,15 @@ private:
ASSERT_EQUALS("", errout.str());
}
void buffer_overrun_17() // ticket #2548
{
check("void f() {\n"
" char t[8];\n"
" sprintf(t, \"%s\", \"foo bar\");\n"
"}\n");
ASSERT_EQUALS("[test.cpp:3]: (error) Buffer access out-of-bounds\n", errout.str());
}
void buffer_overrun_bailoutIfSwitch()
{
// No false positive