Skip to content

Commit

Permalink
Merge r164408 - Crash in WTF::StringBuilder::append()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Jon Honeycutt authored and carlosgcampos committed Apr 14, 2014
1 parent 08d744a commit ed91dce
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
16 changes: 16 additions & 0 deletions Source/WTF/ChangeLog
@@ -1,3 +1,19 @@
2014-02-19 Jon Honeycutt <jhoneycutt@apple.com>

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-17 Ryan Lortie <desrt@desrt.ca>

Enable DFG_JIT on FreeBSD
Expand Down
6 changes: 3 additions & 3 deletions Source/WTF/wtf/text/StringBuilder.cpp
Expand Up @@ -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
Expand Down

0 comments on commit ed91dce

Please sign in to comment.