diff options
author | Mathias Stearn <mathias@10gen.com> | 2019-01-25 17:56:37 -0500 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2019-02-07 14:06:10 -0500 |
commit | 24a0276f123949081c1cd0d1c7876551b3f065a1 (patch) | |
tree | a30e1428cd7a78e8177515ca87cfdc4617cd01a0 /src/mongo/db/pipeline/document_value_test.cpp | |
parent | 2f1881db90c1ae016561fa15274a5b5dee46e986 (diff) | |
download | mongo-24a0276f123949081c1cd0d1c7876551b3f065a1.tar.gz |
SERVER-39209 DocumentStorage::clone() shouldn't allocate a buffer is source didn't have one
Diffstat (limited to 'src/mongo/db/pipeline/document_value_test.cpp')
-rw-r--r-- | src/mongo/db/pipeline/document_value_test.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/document_value_test.cpp b/src/mongo/db/pipeline/document_value_test.cpp index 82f264cdf60..7d9c82bfa5d 100644 --- a/src/mongo/db/pipeline/document_value_test.cpp +++ b/src/mongo/db/pipeline/document_value_test.cpp @@ -111,6 +111,14 @@ TEST(DocumentConstruction, FromEmptyDocumentClone) { // Prior to SERVER-26462, cloning an empty document would cause a segmentation fault. Document documentClone = document.clone(); ASSERT_DOCUMENT_EQ(document, documentClone); + + // Prior to SERVER-39209 this would make ASAN complain. + Document documentClone2 = documentClone.clone(); + ASSERT_DOCUMENT_EQ(document, documentClone2); + + // For good measure, try a third clone + Document documentClone3 = documentClone2.clone(); + ASSERT_DOCUMENT_EQ(document, documentClone3); } /** |