Browse Source

Addressed asan failures caused by misuse of APIs within unit tests.

Jared Mulconry 8 years ago
parent
commit
29e46e4bb8
2 changed files with 3 additions and 2 deletions
  1. 2 1
      test/unit/utObjTools.cpp
  2. 1 1
      test/unit/utSharedPPData.cpp

+ 2 - 1
test/unit/utObjTools.cpp

@@ -106,8 +106,9 @@ TEST_F( utObjTools, countComponents_TwoLines_Success ) {
     TestObjFileParser test_parser;
     std::string data( "-2.061493116917992e-15 -0.9009688496589661 \\\n-0.4338837265968323" );
     std::vector<char> buffer;
-    buffer.resize( data.size() );
+    buffer.resize( data.size() + 1 );
     ::memcpy( &buffer[ 0 ], &data[ 0 ], data.size() );
+    buffer[ buffer.size() - 1 ] = '\0';
     test_parser.setBuffer( buffer );
 
     size_t numComps = test_parser.testGetNumComponentsInDataDefinition();

+ 1 - 1
test/unit/utSharedPPData.cpp

@@ -92,7 +92,7 @@ TEST_F(SharedPPDataTest, testPODProperty)
 // ------------------------------------------------------------------------------------------------
 TEST_F(SharedPPDataTest, testPropertyPointer)
 {
-    int *i = new int[35];
+    int *i = new int;
     shared->AddProperty("test16",i);
     int* o;
     EXPECT_TRUE(shared->GetProperty("test16",o));