summaryrefslogtreecommitdiffstats
path: root/src/dabOutput/edi/PFT.h
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2014-05-17 18:01:26 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2014-05-20 21:39:37 +0200
commitac2e922067be306a89cd10419263cade54b2f60f (patch)
tree04486fac3fd732a3e8f52ac4eea337cecf70ab0b /src/dabOutput/edi/PFT.h
parent8a4f546b85d0887d1d5af0a428753c7d31304b72 (diff)
downloaddabmux-ac2e922067be306a89cd10419263cade54b2f60f.tar.gz
dabmux-ac2e922067be306a89cd10419263cade54b2f60f.tar.bz2
dabmux-ac2e922067be306a89cd10419263cade54b2f60f.zip
fix segfault with EDI
Diffstat (limited to 'src/dabOutput/edi/PFT.h')
-rw-r--r--src/dabOutput/edi/PFT.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/dabOutput/edi/PFT.h b/src/dabOutput/edi/PFT.h
index 713170f..55ca569 100644
--- a/src/dabOutput/edi/PFT.h
+++ b/src/dabOutput/edi/PFT.h
@@ -34,6 +34,7 @@
#include "config.h"
#include <vector>
#include <list>
+#include <stdexcept>
#include <stdint.h>
#include "AFPacket.h"
#include "Log.h"
@@ -44,11 +45,19 @@ typedef std::vector<uint8_t> RSPacket;
class PFT
{
public:
- static const int ParityBytes = 255 - 207;
+ static const int ParityBytes = 48;
PFT(unsigned int RSDataWordLength, unsigned int NumRecoverableFragments) :
- m_k(RSDataWordLength), m_m(NumRecoverableFragments), m_encoder(255, 207)
+ m_k(RSDataWordLength),
+ m_m(NumRecoverableFragments),
+ m_encoder(m_k + ParityBytes, m_k)
{
+ if (m_k > 207) {
+ etiLog.level(warn) <<
+ "EDI PFT: maximum chunk size is 207.";
+ throw std::out_of_range("EDI PFT Chunk size too large.");
+ }
+
if (m_m > 5) {
etiLog.level(warn) <<
"EDI PFT: high number of recoverable fragments"