Ignore:
Timestamp:
Jul 3, 2020, 1:06:51 PM (5 years ago)
Author:
[email protected]
Message:

[JSC] Add exception checks before and after viewWithUnderlyingString
https://bugs.webkit.org/show_bug.cgi?id=213923
<rdar://problem/65068473>

Reviewed by Sam Weinig.

JSTests:

  • stress/exception-checks-before-and-after-viewwithunderlyingstring.js: Added.

(shouldThrow):

Source/JavaScriptCore:

This patch inserts missing exception checks before and after viewWithUnderlyingString.

  • jsc.cpp:

(printInternal):
(functionDebug):

  • runtime/FunctionConstructor.cpp:

(JSC::constructFunctionSkippingEvalEnabledCheck):

  • runtime/JSGlobalObjectFunctions.cpp:

(JSC::globalFuncParseFloat):

  • runtime/JSONObject.cpp:

(JSC::JSONProtoFuncParse):

  • runtime/StringPrototype.cpp:

(JSC::stringProtoFuncCharAt):
(JSC::stringProtoFuncCharCodeAt):

File:
1 edited

Legend:

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

    r263035 r263905  
    528528EncodedJSValue JSC_HOST_CALL globalFuncParseFloat(JSGlobalObject* globalObject, CallFrame* callFrame)
    529529{
    530     auto viewWithString = callFrame->argument(0).toString(globalObject)->viewWithUnderlyingString(globalObject);
     530    VM& vm = globalObject->vm();
     531    auto scope = DECLARE_THROW_SCOPE(vm);
     532
     533    auto* jsString = callFrame->argument(0).toString(globalObject);
     534    RETURN_IF_EXCEPTION(scope, { });
     535    auto viewWithString = jsString->viewWithUnderlyingString(globalObject);
     536    RETURN_IF_EXCEPTION(scope, { });
    531537    return JSValue::encode(jsNumber(parseFloat(viewWithString.view)));
    532538}
Note: See TracChangeset for help on using the changeset viewer.