SDRDaemoFEC plugin: fixed possible segfault

This commit is contained in:
f4exb 2016-12-11 14:32:10 +01:00
parent d3d6ebec89
commit abad9d7299
2 changed files with 6 additions and 0 deletions

View File

@ -402,6 +402,11 @@ uint8_t *SDRdaemonFECBuffer::readData(int32_t length)
m_nbReads++;
// SEGFAULT FIX: arbitratily truncate so that it does not exceed buffer length
if (length > framesSize) {
length = framesSize;
}
if (m_readIndex + length < m_framesNbBytes) // ends before buffer bound
{
m_readIndex += length;

View File

@ -69,6 +69,7 @@ public:
};
static const int samplesPerBlock = (SDRDAEMONFEC_UDPSIZE - sizeof(Header)) / sizeof(Sample);
static const int framesSize = SDRDAEMONFEC_NBDECODERSLOTS * (SDRDAEMONFEC_NBORIGINALBLOCKS - 1) * (SDRDAEMONFEC_UDPSIZE - sizeof(Header));
struct ProtectedBlock
{