Fixed Issue 22 memory corruption via operator =

git-svn-id: https://rapidjson.googlecode.com/svn/trunk@74 c5894555-1306-4e8d-425f-1f6f381ee07c
This commit is contained in:
miloyip@gmail.com 2012-11-14 02:44:45 +00:00
parent 152c2eff6c
commit 9fb77b114b
2 changed files with 11 additions and 0 deletions

View File

@ -801,6 +801,9 @@ public:
}
private:
// Prohibit assignment
GenericDocument& operator=(const GenericDocument&);
void ClearStack() {
if (Allocator::kNeedFree)
while (stack_.GetSize() > 0) // Here assumes all elements in stack array are GenericValue (Member is actually 2 GenericValue objects)

View File

@ -82,3 +82,11 @@ TEST(Document, UTF16_Document) {
EXPECT_EQ(0, wcscmp(L"Wed Oct 30 17:13:20 +0000 2012", s.GetString()));
}
// Issue 22: Memory corruption via operator=
// Fixed by making unimplemented assignment operator private.
//TEST(Document, Assignment) {
// Document d1;
// Document d2;
// d1 = d2;
//}