Ignore:
Timestamp:
May 11, 2017, 4:05:01 PM (8 years ago)
Author:
[email protected]
Message:

Callers of JSString::unsafeView() should check exceptions
https://bugs.webkit.org/show_bug.cgi?id=171995

Reviewed by Mark Lam.

unsafeView() can throw OOME. So, callers of unsafeView() should check for exceptions before trying
to access the view.

Also, I made the functions surrounding unsafeView() take ExecState* not ExecState&, to comply with
the rest of JSC.

  • dfg/DFGOperations.cpp:
  • jsc.cpp:

(printInternal):
(functionDebug):

  • runtime/ArrayPrototype.cpp:

(JSC::arrayProtoFuncJoin):

  • runtime/FunctionConstructor.cpp:

(JSC::constructFunctionSkippingEvalEnabledCheck):

  • runtime/IntlCollatorPrototype.cpp:

(JSC::IntlCollatorFuncCompare):

  • runtime/JSGenericTypedArrayViewPrototypeFunctions.h:

(JSC::genericTypedArrayViewProtoFuncJoin):

  • runtime/JSGlobalObjectFunctions.cpp:

(JSC::globalFuncParseFloat):

  • runtime/JSONObject.cpp:

(JSC::JSONProtoFuncParse):

  • runtime/JSString.cpp:

(JSC::JSString::getPrimitiveNumber):
(JSC::JSString::toNumber):

  • runtime/JSString.h:

(JSC::JSString::getIndex):
(JSC::JSRopeString::unsafeView):
(JSC::JSRopeString::viewWithUnderlyingString):
(JSC::JSString::unsafeView):
(JSC::JSString::viewWithUnderlyingString):

  • runtime/JSStringJoiner.h:

(JSC::JSStringJoiner::appendWithoutSideEffects):
(JSC::JSStringJoiner::append):

  • runtime/ParseInt.h:

(JSC::toStringView):

  • runtime/StringPrototype.cpp:

(JSC::stringProtoFuncRepeatCharacter):
(JSC::stringProtoFuncCharAt):
(JSC::stringProtoFuncCharCodeAt):
(JSC::stringProtoFuncIndexOf):
(JSC::stringProtoFuncNormalize):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSONObject.cpp

    r216428 r216699  
    786786    if (!exec->argumentCount())
    787787        return throwVMError(exec, scope, createError(exec, ASCIILiteral("JSON.parse requires at least one parameter")));
    788     auto viewWithString = exec->uncheckedArgument(0).toString(exec)->viewWithUnderlyingString(*exec);
     788    auto viewWithString = exec->uncheckedArgument(0).toString(exec)->viewWithUnderlyingString(exec);
    789789    RETURN_IF_EXCEPTION(scope, { });
    790790    StringView view = viewWithString.view;
Note: See TracChangeset for help on using the changeset viewer.