Avoid a couple of zero-sized fastMalloc calls
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 14 Sep 2013 00:26:13 +0000 (00:26 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 14 Sep 2013 00:26:13 +0000 (00:26 +0000)
commita8dbdb708847d1aa206f34753957b635e1cdff64
tree1f2aa66fff0691a1d610fe663346223bc801bea5
parent685b38d0349f14a72745ae77203d4435be6419c1
Avoid a couple of zero-sized fastMalloc calls
https://bugs.webkit.org/show_bug.cgi?id=121333

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

* API/JSStringRefCF.cpp:
(JSStringCopyCFString):
Return an empty constant CFStringRef if the JSStringRef is empty.

* runtime/JSPropertyNameIterator.cpp:
(JSC::JSPropertyNameIterator::JSPropertyNameIterator):
Don't allocate an empty m_jsStrings array if m_jsStringsSize is 0.

Source/WTF:

* wtf/text/StringBuffer.h:
(WTF::StringBuffer::StringBuffer):
Initialize m_data to null if m_length is null, and use Checked<size_t> to check for
overflow when multiplying m_length with the character size.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@155734 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/API/JSStringRefCF.cpp
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp
Source/WTF/ChangeLog
Source/WTF/wtf/text/StringBuffer.h