Title: [164408] trunk/Source/WTF
Revision
164408
Author
[email protected]
Date
2014-02-19 19:03:39 -0800 (Wed, 19 Feb 2014)

Log Message

Crash in WTF::StringBuilder::append()

https://bugs.webkit.org/show_bug.cgi?id=125817
<rdar://problem/15671883>

Reviewed by Oliver Hunt.

* wtf/text/StringBuilder.cpp:
(WTF::expandedCapacity):
Ensure that we return a new capacity of at least 'requiredLength' in
the case where requiredLength is large. Also, use unsigned rather than
size_t for the parameters and the return value, as callers pass
unsigned arguments and treat the result as an unsigned int.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (164407 => 164408)


--- trunk/Source/WTF/ChangeLog	2014-02-20 02:08:30 UTC (rev 164407)
+++ trunk/Source/WTF/ChangeLog	2014-02-20 03:03:39 UTC (rev 164408)
@@ -1,3 +1,19 @@
+2014-02-19  Jon Honeycutt  <[email protected]>
+
+        Crash in WTF::StringBuilder::append()
+
+        https://bugs.webkit.org/show_bug.cgi?id=125817
+        <rdar://problem/15671883>
+
+        Reviewed by Oliver Hunt.
+
+        * wtf/text/StringBuilder.cpp:
+        (WTF::expandedCapacity):
+        Ensure that we return a new capacity of at least 'requiredLength' in
+        the case where requiredLength is large. Also, use unsigned rather than
+        size_t for the parameters and the return value, as callers pass
+        unsigned arguments and treat the result as an unsigned int.
+
 2014-02-19  Anders Carlsson  <[email protected]>
 
         Add WTF_MAKE_FAST_ALLOCATED to more classes

Modified: trunk/Source/WTF/wtf/text/StringBuilder.cpp (164407 => 164408)


--- trunk/Source/WTF/wtf/text/StringBuilder.cpp	2014-02-20 02:08:30 UTC (rev 164407)
+++ trunk/Source/WTF/wtf/text/StringBuilder.cpp	2014-02-20 03:03:39 UTC (rev 164408)
@@ -33,10 +33,10 @@
 
 namespace WTF {
 
-static size_t expandedCapacity(size_t capacity, size_t newLength)
+static unsigned expandedCapacity(unsigned capacity, unsigned requiredLength)
 {
-    static const size_t minimumCapacity = 16;
-    return std::max(capacity, std::max(minimumCapacity, newLength * 2));
+    static const unsigned minimumCapacity = 16;
+    return std::max(requiredLength, std::max(minimumCapacity, capacity * 2));
 }
 
 void StringBuilder::reifyString() const
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to