Fix out of bounds access in test.

The test code constructed an `std::string` without a size from a
non-terminated string, which causes a memory error.

Test: atest 'DefaultVhalImplTest#testDump' on flame_hwasan
Bug: 233677013
Change-Id: I7d27c009c2e3307895a4a741743332fd4eed0e24
This commit is contained in:
Florian Mayer 2022-05-23 16:50:36 -07:00
parent 852411b922
commit e4ffd01586

View file

@ -402,7 +402,7 @@ TEST_F(DefaultVhalImplTest, testDump) {
gotValue->timestamp = 0;
std::string infoMake = toString(*gotValue);
EXPECT_THAT(std::string(buf), HasSubstr(infoMake));
EXPECT_THAT(std::string(buf, sizeof(buf)), HasSubstr(infoMake));
}
TEST_F(DefaultVhalImplTest, testSetPropInvalidAreaId) {