git.cweiske.de
/
enigma2.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d58ca4c
)
optional fuzzing support
author
Felix Domke
<tmbinc@elitedvb.net>
Wed, 18 Feb 2009 02:09:08 +0000
(
03:09
+0100)
committer
Felix Domke
<tmbinc@elitedvb.net>
Wed, 18 Feb 2009 02:09:08 +0000
(
03:09
+0100)
lib/dvb/demux.cpp
patch
|
blob
|
history
diff --git
a/lib/dvb/demux.cpp
b/lib/dvb/demux.cpp
index 918ecec6bf6dca4c0a1b9ef33541e7ff97d437eb..11465186c35a447594e70935560e2275d9b3e5cd 100644
(file)
--- a/
lib/dvb/demux.cpp
+++ b/
lib/dvb/demux.cpp
@@
-5,6
+5,13
@@
#include <unistd.h>
#include <signal.h>
#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>
#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);
__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");
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
#else
sct.flags = DMX_IMMEDIATE_START;
#endif
+#if !FUZZING
if (mask.flags & eDVBSectionFilterMask::rfCRC)
{
sct.flags |= DMX_CHECK_CRC;
checkcrc = 1;
} else
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);
checkcrc = 0;
memcpy(sct.filter.filter, mask.data, DMX_FILTER_SIZE);