Changeset 217005 in webkit


Ignore:
Timestamp:
May 17, 2017 2:53:01 PM (7 years ago)
Author:
pvollan@apple.com
Message:

Crash under WebCore::AudioSourceProviderAVFObjC::process().
https://bugs.webkit.org/show_bug.cgi?id=172101
rdar://problem/27446589

Reviewed by Jer Noble.

Calling the function MTAudioProcessingTapGetSourceAudio when the value of the
MTAudioProcessingTapRef parameter is null, will lead to a null dereference.
This can for example happen if MediaPlayerPrivateAVFoundationObjC::cancelLoad()
is called on the main thread while MediaToolbox is calling the
WebCore::AudioSourceProviderAVFObjC::processCallback function on a secondary
thread. MediaPlayerPrivateAVFoundationObjC::cancelLoad() will then call
AudioSourceProviderAVFObjC::setPlayerItem(nullptr), which will call
AudioSourceProviderAVFObjC::destroyMix(), which will set m_tap to null. When
AudioSourceProviderAVFObjC::process is called on the secondary thread, using
the m_tap member in the call to MTAudioProcessingTapGetSourceAudio, the process
will crash.

No new tests since I am not able to reproduce.

  • platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:

(WebCore::AudioSourceProviderAVFObjC::initCallback):
(WebCore::AudioSourceProviderAVFObjC::process):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r217004 r217005  
     12017-05-17  Per Arne Vollan  <pvollan@apple.com>
     2
     3        Crash under WebCore::AudioSourceProviderAVFObjC::process().
     4        https://bugs.webkit.org/show_bug.cgi?id=172101
     5        rdar://problem/27446589
     6
     7        Reviewed by Jer Noble.
     8
     9        Calling the function MTAudioProcessingTapGetSourceAudio when the value of the
     10        MTAudioProcessingTapRef parameter is null, will lead to a null dereference.
     11        This can for example happen if MediaPlayerPrivateAVFoundationObjC::cancelLoad()
     12        is called on the main thread while MediaToolbox is calling the
     13        WebCore::AudioSourceProviderAVFObjC::processCallback function on a secondary
     14        thread. MediaPlayerPrivateAVFoundationObjC::cancelLoad() will then call
     15        AudioSourceProviderAVFObjC::setPlayerItem(nullptr), which will call
     16        AudioSourceProviderAVFObjC::destroyMix(), which will set m_tap to null. When
     17        AudioSourceProviderAVFObjC::process is called on the secondary thread, using
     18        the m_tap member in the call to MTAudioProcessingTapGetSourceAudio, the process
     19        will crash.
     20
     21        No new tests since I am not able to reproduce.
     22
     23        * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
     24        (WebCore::AudioSourceProviderAVFObjC::initCallback):
     25        (WebCore::AudioSourceProviderAVFObjC::process):
     26
    1272017-05-17  Chris Dumez  <cdumez@apple.com>
    228
  • trunk/Source/WebCore/platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm

    r214227 r217005  
    238238void AudioSourceProviderAVFObjC::initCallback(MTAudioProcessingTapRef tap, void* clientInfo, void** tapStorageOut)
    239239{
     240    ASSERT(tap);
    240241    AudioSourceProviderAVFObjC* _this = static_cast<AudioSourceProviderAVFObjC*>(clientInfo);
    241242    _this->m_tap = tap;
     
    360361{
    361362    UNUSED_PARAM(flags);
     363   
     364    RetainPtr<MTAudioProcessingTapRef> tap = m_tap;
     365    if (!tap)
     366        return;
    362367
    363368    CMItemCount itemCount = 0;
    364369    CMTimeRange rangeOut;
    365     OSStatus status = MTAudioProcessingTapGetSourceAudio(m_tap.get(), numberOfFrames, bufferListInOut, flagsOut, &rangeOut, &itemCount);
     370    OSStatus status = MTAudioProcessingTapGetSourceAudio(tap.get(), numberOfFrames, bufferListInOut, flagsOut, &rangeOut, &itemCount);
    366371    if (status != noErr || !itemCount)
    367372        return;
Note: See TracChangeset for help on using the changeset viewer.