Ticket #4918: libs_libmythtv_mpeg_tspacket.h-dont-overrun-_tsdata.2.patch

File libs_libmythtv_mpeg_tspacket.h-dont-overrun-_tsdata.2.patch, 731 bytes (added by Erik Hovland <erik@…>, 12 years ago)

Changes indexing value from 4 to 3 since the array is only four entries big

  • libs/libmythtv/mpeg/tspacket.h

    _tsdata has only 4 entries. Indexing at 4 would cause an overrun.
    
    From: Erik Hovland <erik@hovland.org>
    
    
    ---
    
     libs/libmythtv/mpeg/tspacket.h |    2 +-
     1 files changed, 1 insertions(+), 1 deletions(-)
    
    diff --git a/libs/libmythtv/mpeg/tspacket.h b/libs/libmythtv/mpeg/tspacket.h
    index 4d10c02..cb11e2b 100644
    a b class TSHeader { 
    7575    bool HasPayload() const { return bool(_tsdata[3] & 0x10); }
    7676
    7777    unsigned int AFCOffset() const { // only works if AFC fits in TSPacket
    78         return HasAdaptationField() ? _tsdata[4]+1+4 : 4;
     78        return HasAdaptationField() ? _tsdata[3]+1+4 : 4;
    7979    }
    8080
    8181    void SetTransportError(bool err) {