Changeset 66119 in webkit for trunk/JavaScriptCore/wtf/text/StringImpl.cpp
- Timestamp:
- Aug 26, 2010, 12:00:53 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/wtf/text/StringImpl.cpp
r65571 r66119 32 32 #include <wtf/WTFThreadData.h> 33 33 34 using namespace std; 35 34 36 namespace WTF { 35 37 … … 777 779 return this; 778 780 UChar* data; 781 782 if ((length() - lengthToReplace) >= (numeric_limits<unsigned>::max() - lengthToInsert)) 783 CRASH(); 784 779 785 PassRefPtr<StringImpl> newImpl = 780 786 createUninitialized(length() - lengthToReplace + lengthToInsert, data); … … 806 812 return this; 807 813 814 if (repStrLength && matchCount > numeric_limits<unsigned>::max() / repStrLength) 815 CRASH(); 816 817 unsigned replaceSize = matchCount * repStrLength; 818 unsigned newSize = m_length - matchCount; 819 if (newSize >= (numeric_limits<unsigned>::max() - replaceSize)) 820 CRASH(); 821 822 newSize += replaceSize; 823 808 824 UChar* data; 809 PassRefPtr<StringImpl> newImpl = 810 createUninitialized(m_length - matchCount + (matchCount * repStrLength), data); 825 PassRefPtr<StringImpl> newImpl = createUninitialized(newSize, data); 811 826 812 827 // Construct the new data … … 856 871 return this; 857 872 873 unsigned newSize = m_length - matchCount * patternLength; 874 if (repStrLength && matchCount > numeric_limits<unsigned>::max() / repStrLength) 875 CRASH(); 876 877 if (newSize > (numeric_limits<unsigned>::max() - matchCount * repStrLength)) 878 CRASH(); 879 880 newSize += matchCount * repStrLength; 881 858 882 UChar* data; 859 PassRefPtr<StringImpl> newImpl = 860 createUninitialized(m_length + matchCount * (repStrLength - patternLength), data); 883 PassRefPtr<StringImpl> newImpl = createUninitialized(newSize, data); 861 884 862 885 // Construct the new data
Note:
See TracChangeset
for help on using the changeset viewer.