Browse Source

dvbs2: Validate BCH information length before deframing

Reject non-positive BCH information lengths before scrambling
or decoding the frame, and log a warning with the invalid value.

Coverity CID 657505 identified a potential negative length
passed to scrambleBytes().

Signed-off-by: Robin Getz <rgetz503@gmail.com>
chirpmodem-v8.1.0
Robin Getz 4 weeks ago
parent
commit
3a4a6fb87a
No known key found for this signature in database
GPG Key ID: 51C7231FFED0E060
  1. 5
      modemdvb/dvbs2receiver.cpp

5
modemdvb/dvbs2receiver.cpp

@ -20,6 +20,7 @@ @@ -20,6 +20,7 @@
#include <chrono>
#include <cmath>
#include <cstring>
#include <QDebug>
#include "util/profiler.h"
#include "dvbs2receiver.h"
@ -892,6 +893,10 @@ void Receiver::deframe(FrameSlot& slot) @@ -892,6 +893,10 @@ void Receiver::deframe(FrameSlot& slot)
{
const XFECFrame& frame = slot.m_frame;
const int kbch = frame.m_vlsnr >= 0 ? vlsnrKbch(frame.m_vlsnr) : dvbt2::kbch(frame.m_fecType, frame.m_rate, CodeFamily::S2);
if (kbch <= 0) {
qWarning() << "Receiver::deframe: Invalid BCH information length" << kbch;
return;
}
const bool bad = slot.m_corrected < 0;
dvbt2::scrambleBytes(slot.m_packed.data(), kbch / 8);
dvbt2::BBFrameDecoder::Header header;

Loading…
Cancel
Save