Commit 9fb77b11 authored by miloyip@gmail.com's avatar miloyip@gmail.com

Fixed Issue 22 memory corruption via operator =

git-svn-id: https://rapidjson.googlecode.com/svn/trunk@74 c5894555-1306-4e8d-425f-1f6f381ee07c
parent 152c2eff
...@@ -801,6 +801,9 @@ public: ...@@ -801,6 +801,9 @@ public:
} }
private: private:
// Prohibit assignment
GenericDocument& operator=(const GenericDocument&);
void ClearStack() { void ClearStack() {
if (Allocator::kNeedFree) if (Allocator::kNeedFree)
while (stack_.GetSize() > 0) // Here assumes all elements in stack array are GenericValue (Member is actually 2 GenericValue objects) while (stack_.GetSize() > 0) // Here assumes all elements in stack array are GenericValue (Member is actually 2 GenericValue objects)
......
...@@ -82,3 +82,11 @@ TEST(Document, UTF16_Document) { ...@@ -82,3 +82,11 @@ TEST(Document, UTF16_Document) {
EXPECT_EQ(0, wcscmp(L"Wed Oct 30 17:13:20 +0000 2012", s.GetString())); 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;
//}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment