Fix undefined behaviour in data formatter test -- ensure char* null-terminated

so LLDB does not read off the end of the array.

llvm-svn: 184877
This commit is contained in:
Daniel Malea 2013-06-25 20:54:24 +00:00
parent 2f0d590713
commit 795cc3afc3
1 changed files with 6 additions and 3 deletions

View File

@ -61,8 +61,11 @@ struct SimpleWithPointers
SimpleWithPointers(int X, float Y, char Z) :
x(new int (X)),
y(new float (Y)),
z(new char (Z))
{}
z(new char[2])
{
z[0] = Z;
z[1] = '\0';
}
};
struct Couple
@ -168,4 +171,4 @@ int main (int argc, const char * argv[])
VeryLong a_long_guy;
return 0; // Set break point at this line.
}
}