Ticket #1456: pespacket-underflow-fix2.patch
File pespacket-underflow-fix2.patch, 1.3 KB (added by , 20 years ago) |
---|
-
libs/libmythtv/mpeg/pespacket.h
59 59 _pesdataSize(0), _allocSize(0) 60 60 { 61 61 _badPacket = !VerifyCRC(); 62 _pesdataSize = max(Length()-1 + (HasCRC() ? 4 : 0), (uint)0); 62 _pesdataSize = Length() + (HasCRC() ? 4 : 0); 63 if (_pesdataSize > 0) 64 _pesdataSize -= 1; 63 65 } 64 66 65 67 private: … … 211 213 212 214 uint CRC() const 213 215 { 214 uint offset = Length() - 1; 216 uint offset = Length(); 217 if (offset > 0) offset -= 1; 215 218 return ((_pesdata[offset+0]<<24) | 216 219 (_pesdata[offset+1]<<16) | 217 220 (_pesdata[offset+2]<<8) | … … 219 222 } 220 223 221 224 uint CalcCRC() const 222 { return mpegts_crc32(_pesdata, Length()-1); } 225 { 226 uint offset = Length(); 227 if (offset > 0) offset -= 1; 228 return mpegts_crc32(_pesdata, offset); } 223 229 224 230 void SetCRC(uint crc) 225 231 { 226 uint offset = Length() - 1; 232 uint offset = Length(); 233 if (offset > 0) offset -= 1; 227 234 _pesdata[offset+0] = (crc & 0xff000000) >> 24; 228 235 _pesdata[offset+1] = (crc & 0x00ff0000) >> 16; 229 236 _pesdata[offset+2] = (crc & 0x0000ff00) >> 8;