⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 280828 in webkit


Ignore:
Timestamp:
Aug 10, 2021, 1:57:20 AM (5 years ago)
Author:
Adrian Perez de Castro
Message:

Merge r273692 - Protect AudioWorkletGlobalScope::registerProcessor() against re-entry
https://bugs.webkit.org/show_bug.cgi?id=222567
<rdar://74860464>

Reviewed by Eric Carlson.

AudioWorkletGlobalScope::registerProcessor() checks if 'name' is in m_processorConstructorMap
then does some checks that potentially run JS and thus call registerProcessor() again (potentially
with the same name). To address this, we now check the map again after potentially running the
JS code.

  • Modules/webaudio/AudioWorkletGlobalScope.cpp:

(WebCore::AudioWorkletGlobalScope::registerProcessor):

Location:
releases/WebKitGTK/webkit-2.32/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • releases/WebKitGTK/webkit-2.32/Source/WebCore/ChangeLog

    r280804 r280828  
     12021-03-01  Chris Dumez  <cdumez@apple.com>
     2
     3        Protect AudioWorkletGlobalScope::registerProcessor() against re-entry
     4        https://bugs.webkit.org/show_bug.cgi?id=222567
     5        <rdar://74860464>
     6
     7        Reviewed by Eric Carlson.
     8
     9        AudioWorkletGlobalScope::registerProcessor() checks if 'name' is in m_processorConstructorMap
     10        then does some checks that potentially run JS and thus call registerProcessor() again (potentially
     11        with the same name). To address this, we now check the map again after potentially running the
     12        JS code.
     13
     14        * Modules/webaudio/AudioWorkletGlobalScope.cpp:
     15        (WebCore::AudioWorkletGlobalScope::registerProcessor):
     16
    1172021-03-03  Julian Gonzalez  <julian_a_gonzalez@apple.com>
    218
  • releases/WebKitGTK/webkit-2.32/Source/WebCore/Modules/webaudio/AudioWorkletGlobalScope.cpp

    r279324 r280828  
    8383
    8484    if (!jsConstructor->isConstructor(vm))
    85         return Exception { TypeError, "Class definitition passed to registerProcessor() is not a constructor"_s };
     85        return Exception { TypeError, "Class definition passed to registerProcessor() is not a constructor"_s };
    8686
    8787    auto prototype = jsConstructor->getPrototype(vm, globalObject);
     
    8989
    9090    if (!prototype.isObject())
    91         return Exception { TypeError, "Class definitition passed to registerProcessor() has invalid prototype"_s };
     91        return Exception { TypeError, "Class definition passed to registerProcessor() has invalid prototype"_s };
    9292
    9393    auto parameterDescriptorsValue = jsConstructor->get(globalObject, JSC::Identifier::fromString(vm, "parameterDescriptors"));
     
    111111    }
    112112
    113     m_processorConstructorMap.add(name, WTFMove(processorContructor));
     113    auto addResult = m_processorConstructorMap.add(name, WTFMove(processorContructor));
     114
     115    // We've already checked at the beginning of this function but then we ran some JS so we need to check again.
     116    if (!addResult.isNewEntry)
     117        return Exception { NotSupportedError, "A processor was already registered with this name"_s };
    114118
    115119    thread().messagingProxy().postTaskToAudioWorklet([name = name.isolatedCopy(), parameterDescriptors = crossThreadCopy(parameterDescriptors)](AudioWorklet& worklet) mutable {
Note: See TracChangeset for help on using the changeset viewer.