mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-10-01 01:06:35 -04:00
SDRDaemoFEC plugin: fixed possible segfault
This commit is contained in:
parent
d3d6ebec89
commit
abad9d7299
@ -402,6 +402,11 @@ uint8_t *SDRdaemonFECBuffer::readData(int32_t length)
|
|||||||
|
|
||||||
m_nbReads++;
|
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
|
if (m_readIndex + length < m_framesNbBytes) // ends before buffer bound
|
||||||
{
|
{
|
||||||
m_readIndex += length;
|
m_readIndex += length;
|
||||||
|
@ -69,6 +69,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const int samplesPerBlock = (SDRDAEMONFEC_UDPSIZE - sizeof(Header)) / sizeof(Sample);
|
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
|
struct ProtectedBlock
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user