Skip to content

Commit 50cb424

Browse files
committed
Test assignment from inner Value.
1 parent c033292 commit 50cb424

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/unittest/valuetest.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,6 +1119,16 @@ TEST(Value, Array) {
11191119
z.SetArray();
11201120
EXPECT_TRUE(z.IsArray());
11211121
EXPECT_TRUE(z.Empty());
1122+
1123+
// PR #1503: assign from inner Value
1124+
{
1125+
CrtAllocator a; // Free() is not a noop
1126+
GenericValue<UTF8<>, CrtAllocator> nullValue;
1127+
GenericValue<UTF8<>, CrtAllocator> arrayValue(kArrayType);
1128+
arrayValue.PushBack(nullValue, a);
1129+
arrayValue = arrayValue[0]; // shouldn't crash (use after free)
1130+
EXPECT_TRUE(arrayValue.IsNull());
1131+
}
11221132
}
11231133

11241134
TEST(Value, ArrayHelper) {

0 commit comments

Comments
 (0)