Ticket #5518: libs_libmythtv-reverse-inull.patch

File libs_libmythtv-reverse-inull.patch, 2.7 KB (added by Erik Hovland <erik@…>, 11 years ago)

deals with dereference before null check defects in NuppelVideoPlayer?.cpp and tv_play.cpp

  • mythtv/libs/libmythtv/NuppelVideoPlayer.cpp

    This defect is where a pointer is checked after it is
    
    From: Erik Hovland <erik@hovland.org>
    
    dereferenced.
    ---
    
     mythtv/libs/libmythtv/NuppelVideoPlayer.cpp |    2 +-
     mythtv/libs/libmythtv/tv_play.cpp           |   14 +++++++++++---
     2 files changed, 12 insertions(+), 4 deletions(-)
    
    diff --git a/mythtv/libs/libmythtv/NuppelVideoPlayer.cpp b/mythtv/libs/libmythtv/NuppelVideoPlayer.cpp
    index e2223f4..282e718 100644
    a b bool NuppelVideoPlayer::PrebufferEnoughFrames(void) 
    25982598    prebuffering_lock.unlock();
    25992599
    26002600    //VERBOSE(VB_PLAYBACK, LOC + "fs: " + videoOutput->GetFrameStatus());
    2601     if (!videoOutput->EnoughPrebufferedFrames())
     2601    if (videoOutput && !videoOutput->EnoughPrebufferedFrames())
    26022602    {
    26032603        VERBOSE(VB_GENERAL, LOC + "prebuffering pause");
    26042604        if (videoOutput)
  • mythtv/libs/libmythtv/tv_play.cpp

    diff --git a/mythtv/libs/libmythtv/tv_play.cpp b/mythtv/libs/libmythtv/tv_play.cpp
    index 0a80b3e..f0fa300 100644
    a b bool TV::StartRecorder(RemoteEncoder *rec, int maxWait) 
    17851785 */
    17861786bool TV::StartPlayer(bool isWatchingRecording, int maxWait)
    17871787{
     1788    if (!nvp)
     1789    {
     1790        VERBOSE(VB_IMPORTANT, LOC_ERR +
     1791                QString("StartPlayer(): NVP is NULL"));
     1792        return false;
     1793    }
     1794
    17881795    SetupPlayer(isWatchingRecording);
    17891796    if (pthread_create(&decode, NULL, SpawnDecode, nvp))
    17901797        return false;
    void TV::SwapPIP(void) 
    40724079    prbuffer->Unpause();
    40734080    StartPlayer(false);
    40744081    activenvp = nvp;
    4075     nvp->FastForward(pip.frame/recorder->GetFrameRate());
     4082    if (nvp)
     4083        nvp->FastForward(pip.frame/recorder->GetFrameRate());
    40764084
    40774085    // if we were muted before swapping PIP we need to restore it here
    40784086    if (muted && nvp)
    void TV::BuildOSDTreeMenu(void) 
    75257533        FillMenuTracks(treeMenu, kTrackTypeTeletextCaptions);
    75267534    }
    75277535
    7528     AspectOverrideMode aspectoverride = nvp->GetAspectOverride();
     7536    AspectOverrideMode aspectoverride = (nvp ? nvp->GetAspectOverride() : kAspect_Off);
    75297537    OSDGenericTree *car_item = new OSDGenericTree(
    75307538        treeMenu, tr("Change Aspect Ratio"));
    75317539    for (int j = kAspect_Off; j < kAspect_END; j++)
    void TV::BuildOSDTreeMenu(void) 
    75417549                           (sel) ? 1 : 0, NULL, "ASPECTGROUP");
    75427550    }
    75437551
    7544     AdjustFillMode adjustfill = nvp->GetAdjustFill();
     7552    AdjustFillMode adjustfill = (nvp ? nvp->GetAdjustFill() : kAdjustFill_Off);
    75457553    OSDGenericTree *af_item = new OSDGenericTree(treeMenu, tr("Adjust Fill"));
    75467554    for (int i = kAdjustFill_Off; i < kAdjustFill_END; i++)
    75477555    {