Ticket #5129: libs_libmythtv_dvbrecorder.cpp-make-sure-pid-doesnt-overrun-pid_status.patch

File libs_libmythtv_dvbrecorder.cpp-make-sure-pid-doesnt-overrun-pid_status.patch, 927 bytes (added by Erik Hovland <erik@…>, 12 years ago)

check pid for 0x1fff before putting it into _pid_status

  • libs/libmythtv/dvbrecorder.cpp

    A pid can be 0x01fff (null packet). But the pid_status array only goes to 1fff. So indexing
    
    From: Erik Hovland <erik@hovland.org>
    
    there is not a good idea.
    ---
    
     libs/libmythtv/dvbrecorder.cpp |    2 +-
     1 files changed, 1 insertions(+), 1 deletions(-)
    
    diff --git a/libs/libmythtv/dvbrecorder.cpp b/libs/libmythtv/dvbrecorder.cpp
    index a33ee23..ab46ea6 100644
    a b bool DVBRecorder::ProcessAVTSPacket(const TSPacket &tspacket) 
    533533
    534534    // Sync streams to the first Payload Unit Start Indicator
    535535    // _after_ first keyframe iff _wait_for_keyframe_option is true
    536     if (!(_pid_status[pid] & kPayloadStartSeen) && tspacket.HasPayload())
     536    if (pid != 0x1fff && !(_pid_status[pid] & kPayloadStartSeen) && tspacket.HasPayload())
    537537    {
    538538        if (!tspacket.PayloadStart())
    539539            return true; // not payload start - drop packet