diff options
author | ylavic <ylavic.dev@gmail.com> | 2021-03-16 01:56:55 +0300 |
---|---|---|
committer | ylavic <ylavic.dev@gmail.com> | 2021-03-16 01:57:42 +0300 |
commit | 50cb424c348fe82814196e9ccc04e7efb69d82ca (patch) | |
tree | 8fbe29595f9785aa57a159f0cf4e14c7df7b5709 /test | |
parent | c033292aeaf014accfb5b4054d8fdac36358266c (diff) |
Test assignment from inner Value.
Diffstat (limited to 'test')
-rw-r--r-- | test/unittest/valuetest.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/unittest/valuetest.cpp b/test/unittest/valuetest.cpp index 00f06528..f34d4b00 100644 --- a/test/unittest/valuetest.cpp +++ b/test/unittest/valuetest.cpp @@ -1119,6 +1119,16 @@ TEST(Value, Array) { z.SetArray(); EXPECT_TRUE(z.IsArray()); 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) { |