aboutsummaryrefslogtreecommitdiff
path: root/lib/dvb/demux.cpp
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2009-02-18 03:09:08 +0100
committerFelix Domke <tmbinc@elitedvb.net>2009-02-18 03:09:08 +0100
commit166db5a9c9222c82939eede51d964c706039ebe8 (patch)
treec843469d97216317ceb06a862fbefe891977b245 /lib/dvb/demux.cpp
parentd58ca4cf34b7621aea4e2c1ff07bed6b2cd6b763 (diff)
downloadenigma2-166db5a9c9222c82939eede51d964c706039ebe8.tar.gz
enigma2-166db5a9c9222c82939eede51d964c706039ebe8.zip
optional fuzzing support
Diffstat (limited to 'lib/dvb/demux.cpp')
-rw-r--r--lib/dvb/demux.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/dvb/demux.cpp b/lib/dvb/demux.cpp
index 918ecec6..11465186 100644
--- a/lib/dvb/demux.cpp
+++ b/lib/dvb/demux.cpp
@@ -5,6 +5,13 @@
#include <unistd.h>
#include <signal.h>
+// #define FUZZING 1
+
+#if FUZZING
+ /* change every 1:FUZZING_PROPABILITY byte */
+#define FUZZING_PROPABILITY 100
+#endif
+
#if HAVE_DVB_API_VERSION < 3
#include <ost/dmx.h>
@@ -178,6 +185,14 @@ void eDVBSectionReader::data(int)
__u8 data[4096]; // max. section size
int r;
r = ::read(fd, data, 4096);
+#if FUZZING
+ int j;
+ for (j = 0; j < r; ++j)
+ {
+ if (!(rand()%FUZZING_PROPABILITY))
+ data[j] ^= rand();
+ }
+#endif
if(r < 0)
{
eWarning("ERROR reading section - %m\n");
@@ -243,11 +258,13 @@ RESULT eDVBSectionReader::start(const eDVBSectionFilterMask &mask)
#else
sct.flags = DMX_IMMEDIATE_START;
#endif
+#if !FUZZING
if (mask.flags & eDVBSectionFilterMask::rfCRC)
{
sct.flags |= DMX_CHECK_CRC;
checkcrc = 1;
} else
+#endif
checkcrc = 0;
memcpy(sct.filter.filter, mask.data, DMX_FILTER_SIZE);