Changeset 96438 in webkit
- Timestamp:
- Sep 30, 2011 4:54:44 PM (13 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r96436 r96438 1 2011-09-30 Gavin Barraclough <barraclough@apple.com> 2 3 StringRecursionChecker should not work in terms of EncodedJSValue 4 https://bugs.webkit.org/show_bug.cgi?id=69188 5 6 Reviewed by Oliver Hunt. 7 8 0 is not the empty value on 32_64. 9 Code that casts literals to EncodedJSValues may be unsafe if we change our internal representation. 10 11 * runtime/ArrayPrototype.cpp: 12 (JSC::arrayProtoFuncToString): 13 (JSC::arrayProtoFuncToLocaleString): 14 (JSC::arrayProtoFuncJoin): 15 * runtime/ErrorPrototype.cpp: 16 (JSC::errorProtoFuncToString): 17 * runtime/RegExpPrototype.cpp: 18 (JSC::regExpProtoFuncToString): 19 * runtime/StringRecursionChecker.cpp: 20 (JSC::StringRecursionChecker::throwStackOverflowError): 21 (JSC::StringRecursionChecker::emptyString): 22 * runtime/StringRecursionChecker.h: 23 (JSC::StringRecursionChecker::performCheck): 24 (JSC::StringRecursionChecker::earlyReturnValue): 25 1 26 2011-09-30 Gavin Barraclough <barraclough@apple.com> 2 27 -
trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp
r96243 r96438 181 181 182 182 StringRecursionChecker checker(exec, thisObj); 183 if ( EncodedJSValue earlyReturnValue = checker.earlyReturnValue())184 return earlyReturnValue;183 if (JSValue earlyReturnValue = checker.earlyReturnValue()) 184 return JSValue::encode(earlyReturnValue); 185 185 186 186 unsigned totalSize = length ? length - 1 : 0; … … 244 244 245 245 StringRecursionChecker checker(exec, thisObj); 246 if ( EncodedJSValue earlyReturnValue = checker.earlyReturnValue())247 return earlyReturnValue;246 if (JSValue earlyReturnValue = checker.earlyReturnValue()) 247 return JSValue::encode(earlyReturnValue); 248 248 249 249 JSStringBuilder strBuffer; … … 278 278 279 279 StringRecursionChecker checker(exec, thisObj); 280 if ( EncodedJSValue earlyReturnValue = checker.earlyReturnValue())281 return earlyReturnValue;280 if (JSValue earlyReturnValue = checker.earlyReturnValue()) 281 return JSValue::encode(earlyReturnValue); 282 282 283 283 JSStringBuilder strBuffer; -
trunk/Source/JavaScriptCore/runtime/ErrorPrototype.cpp
r95936 r96438 80 80 81 81 StringRecursionChecker checker(exec, thisObj); 82 if ( EncodedJSValue earlyReturnValue = checker.earlyReturnValue())83 return earlyReturnValue;82 if (JSValue earlyReturnValue = checker.earlyReturnValue()) 83 return JSValue::encode(earlyReturnValue); 84 84 85 85 JSValue name = thisObj->get(exec, exec->propertyNames().name); -
trunk/Source/JavaScriptCore/runtime/RegExpPrototype.cpp
r95936 r96438 143 143 144 144 StringRecursionChecker checker(exec, thisObject); 145 if ( EncodedJSValue earlyReturnValue = checker.earlyReturnValue())146 return earlyReturnValue;145 if (JSValue earlyReturnValue = checker.earlyReturnValue()) 146 return JSValue::encode(earlyReturnValue); 147 147 148 148 char postfix[5] = { '/', 0, 0, 0, 0 }; -
trunk/Source/JavaScriptCore/runtime/StringRecursionChecker.cpp
r76185 r96438 26 26 namespace JSC { 27 27 28 EncodedJSValue StringRecursionChecker::throwStackOverflowError()28 JSValue StringRecursionChecker::throwStackOverflowError() 29 29 { 30 return throw VMError(m_exec, createStackOverflowError(m_exec));30 return throwError(m_exec, createStackOverflowError(m_exec)); 31 31 } 32 32 33 EncodedJSValue StringRecursionChecker::emptyString()33 JSValue StringRecursionChecker::emptyString() 34 34 { 35 return JSValue::encode(jsEmptyString(m_exec));35 return jsEmptyString(m_exec); 36 36 } 37 37 -
trunk/Source/JavaScriptCore/runtime/StringRecursionChecker.h
r76185 r96438 32 32 ~StringRecursionChecker(); 33 33 34 EncodedJSValue earlyReturnValue() const; // 0 if everything is OK, value to return for failure cases34 JSValue earlyReturnValue() const; // 0 if everything is OK, value to return for failure cases 35 35 36 36 private: 37 EncodedJSValue throwStackOverflowError();38 EncodedJSValue emptyString();39 EncodedJSValue performCheck();37 JSValue throwStackOverflowError(); 38 JSValue emptyString(); 39 JSValue performCheck(); 40 40 41 41 ExecState* m_exec; 42 42 JSObject* m_thisObject; 43 EncodedJSValue m_earlyReturnValue;43 JSValue m_earlyReturnValue; 44 44 }; 45 45 46 inline EncodedJSValue StringRecursionChecker::performCheck()46 inline JSValue StringRecursionChecker::performCheck() 47 47 { 48 48 int size = m_exec->globalData().stringRecursionCheckVisitedObjects.size(); … … 52 52 if (alreadyVisited) 53 53 return emptyString(); // Return empty string to avoid infinite recursion. 54 return 0; // Indicate success.54 return JSValue(); // Indicate success. 55 55 } 56 56 … … 62 62 } 63 63 64 inline EncodedJSValue StringRecursionChecker::earlyReturnValue() const64 inline JSValue StringRecursionChecker::earlyReturnValue() const 65 65 { 66 66 return m_earlyReturnValue;
Note: See TracChangeset
for help on using the changeset viewer.