Title: [198579] trunk/Source/WTF
Revision
198579
Author
[email protected]
Date
2016-03-23 01:21:03 -0700 (Wed, 23 Mar 2016)

Log Message

SmallPtrSet leaks memory in its move assignment operator when !this->isSmall()
https://bugs.webkit.org/show_bug.cgi?id=155701

Reviewed by Darin Adler.

* wtf/SmallPtrSet.h:
(WTF::SmallPtrSet::SmallPtrSet):
(WTF::SmallPtrSet::operator=):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (198578 => 198579)


--- trunk/Source/WTF/ChangeLog	2016-03-23 05:46:00 UTC (rev 198578)
+++ trunk/Source/WTF/ChangeLog	2016-03-23 08:21:03 UTC (rev 198579)
@@ -1,3 +1,14 @@
+2016-03-23  Saam Barati  <[email protected]>
+
+        SmallPtrSet leaks memory in its move assignment operator when !this->isSmall()
+        https://bugs.webkit.org/show_bug.cgi?id=155701
+
+        Reviewed by Darin Adler.
+
+        * wtf/SmallPtrSet.h:
+        (WTF::SmallPtrSet::SmallPtrSet):
+        (WTF::SmallPtrSet::operator=):
+
 2016-03-22  Per Arne Vollan  <[email protected]>
 
         [Win] [64-bit] Remove MSVC 2013 FMA3 Bug Workaround

Modified: trunk/Source/WTF/wtf/SmallPtrSet.h (198578 => 198579)


--- trunk/Source/WTF/wtf/SmallPtrSet.h	2016-03-23 05:46:00 UTC (rev 198578)
+++ trunk/Source/WTF/wtf/SmallPtrSet.h	2016-03-23 08:21:03 UTC (rev 198579)
@@ -57,13 +57,14 @@
 
     SmallPtrSet(SmallPtrSet&& other)
     {
-        *this = WTFMove(other);
+        memcpy(this, &other, sizeof(SmallPtrSet));
+        other.initialize();
     }
 
     SmallPtrSet& operator=(SmallPtrSet&& other)
     {
-        memcpy(this, &other, sizeof(SmallPtrSet));
-        other.initialize();
+        this->~SmallPtrSet();
+        new (this) SmallPtrSet(WTFMove(other));
         return *this;
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to