Ticket #5154: programs_mythtranscode_mpeg2fix.cpp-initialize-rb-pointers.patch

File programs_mythtranscode_mpeg2fix.cpp-initialize-rb-pointers.patch, 1.1 KB (added by Erik Hovland <erik@…>, 16 years ago)

initialize rb and rbi, then check them for null

  • programs/mythtranscode/mpeg2fix.cpp

    The pointers rb and rbi are not initialized at the beginning and could
    
    From: Erik Hovland <erik@hovland.org>
    
    potentially be passed as null to callers of MPEG2fixup::AddFrame.
    ---
    
     programs/mythtranscode/mpeg2fix.cpp |    8 +++++++-
     1 files changed, 7 insertions(+), 1 deletions(-)
    
    diff --git a/programs/mythtranscode/mpeg2fix.cpp b/programs/mythtranscode/mpeg2fix.cpp
    index 7278883..9bf6e02 100644
    a b void MPEG2fixup::FrameInfo(MPEG2frame *f) 
    623623int MPEG2fixup::AddFrame(MPEG2frame *f)
    624624{
    625625    index_unit iu;
    626     ringbuffer *rb, *rbi;
     626    ringbuffer *rb = 0, *rbi = 0;
    627627    int id = f->pkt.stream_index;
    628628
    629629    memset(&iu, 0, sizeof(index_unit));
    int MPEG2fixup::AddFrame(MPEG2frame *f) 
    650650        iu.framesize = f->pkt.size;
    651651    }
    652652
     653    if (! rb || ! rbi)
     654    {
     655        VERBOSE(MPF_IMPORTANT, "Ringbuffer pointers empty. No stream found\n");
     656        return 1;
     657    }
     658
    653659    iu.active = 1;
    654660    iu.length = f->pkt.size;
    655661    iu.pts = f->pkt.pts * 300;