Fix ASAN error in vectorstream_test

This commit is contained in:
Ion Gaztañaga
2021-02-13 22:44:42 +01:00
parent 74fac07b21
commit 26be575e66

View File

@@ -103,11 +103,13 @@ static int vectorstream_test()
std_stringstream << "testline: " << i << std::endl;
}
//Add final null to form a c string
my_vectorstream.swap_vector(myvector);
myvector.push_back(0);
if(std::strcmp(&(my_vectorstream.vector()[0]), std_stringstream.str().c_str()) != 0){
if(std::strcmp(&(myvector[0]), std_stringstream.str().c_str()) != 0){
return 1;
}
myvector.pop_back();
my_vectorstream.swap_vector(myvector);
for(int i = 0; i < 100; ++i){
my_vectorstream >> str1 >> number1;
std_stringstream >> str2 >> number2;