Test assignment from inner Value.

This commit is contained in:
ylavic 2021-03-15 23:56:55 +01:00
parent c033292aea
commit 50cb424c34

View File

@ -1119,6 +1119,16 @@ TEST(Value, Array) {
z.SetArray(); z.SetArray();
EXPECT_TRUE(z.IsArray()); EXPECT_TRUE(z.IsArray());
EXPECT_TRUE(z.Empty()); EXPECT_TRUE(z.Empty());
// PR #1503: assign from inner Value
{
CrtAllocator a; // Free() is not a noop
GenericValue<UTF8<>, CrtAllocator> nullValue;
GenericValue<UTF8<>, CrtAllocator> arrayValue(kArrayType);
arrayValue.PushBack(nullValue, a);
arrayValue = arrayValue[0]; // shouldn't crash (use after free)
EXPECT_TRUE(arrayValue.IsNull());
}
} }
TEST(Value, ArrayHelper) { TEST(Value, ArrayHelper) {