Don't search past buffer in TS I-frame cutter.
authorFelix Domke <tmbinc@elitedvb.net>
Tue, 18 Nov 2008 21:20:15 +0000 (22:20 +0100)
committerFelix Domke <tmbinc@elitedvb.net>
Tue, 18 Nov 2008 21:20:15 +0000 (22:20 +0100)
closes #66.

lib/dvb/dvb.cpp

index e04caa0..66ec1d2 100644 (file)
@@ -982,7 +982,7 @@ int eDVBChannelFilePush::filterRecordData(const unsigned char *_data, int len, s
 //     eDebug("filterRecordData, size=%d (mod 188=%d), first byte is %02x", len, len %188, data[0]);
 
        unsigned char *d = data;
-       while ((d = (unsigned char*)memmem(d, data + len - d, "\x00\x00\x01", 3)))
+       while ((d + 3 < data + len) && (d = (unsigned char*)memmem(d, data + len - d, "\x00\x00\x01", 3)))
        {
                int offset = d - data;
                int ts_offset = offset - offset % 188; /* offset to the start of TS packet */