From ced7672560701ab761704543a4b1c3b77d96c667 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 27 Oct 2026 20:05:49 -0400 Subject: [PATCH 01/34] ft8: Fix copy-paste error in 22-bit callsign lookup Fix Coverity CID 652606, which identified a likely copy-paste error in Packing::unpack_5(). The code checked hashes22 for the 22-bit callsign hash but incorrectly retrieved the value from hashes12. Use hashes22 for both operations. Signed-off-by: Robin Getz --- ft8/packing.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ft8/packing.cpp b/ft8/packing.cpp index 7be99f27d..ba0869cb9 100644 --- a/ft8/packing.cpp +++ b/ft8/packing.cpp @@ -380,7 +380,7 @@ std::string Packing::unpack_5(int a77[], std::string& call1str, std::string& cal int x22 = un64(a77, 12, 22); if (hashes22.count(x22) > 0) { - ocall = hashes12[x22]; + ocall = hashes22[x22]; } else { ocall = "<...22>"; } From b2550624e2381d41f073fc01366cb5ab753e8625 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 27 Oct 2026 20:06:43 -0400 Subject: [PATCH 02/34] httpserver: Guard against null uploaded files in destructor Fix Coverity CID 652499 by checking the QTemporaryFile pointer before accessing it. Avoids a potential null dereference when cleaning up uploaded files. Signed-off-by: Robin Getz --- httpserver/httprequest.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/httpserver/httprequest.cpp b/httpserver/httprequest.cpp index 3c8181423..1b82e2040 100644 --- a/httpserver/httprequest.cpp +++ b/httpserver/httprequest.cpp @@ -544,6 +544,9 @@ HttpRequest::~HttpRequest() foreach(QByteArray key, uploadedFiles.keys()) { QTemporaryFile* file=uploadedFiles.value(key); + if (!file) { + continue; + } if (file->isOpen()) { file->close(); From bf733989d1a5e89fe25171413ad5a4eae015a6f6 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 27 Oct 2026 20:08:28 -0400 Subject: [PATCH 03/34] modemdab: Fix integer division in symbol power calculation Fix Coverity CID 657864 by using floating-point division when normalizing symbol power. The previous integer division discarded the fractional part of the divisor. Add 6 before dividing by 7 to account for the loop stepping by 7 samples and rounding the sample count up to include the final partial step. Signed-off-by: Robin Getz --- modemdab/dabofdm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modemdab/dabofdm.cpp b/modemdab/dabofdm.cpp index 1131a4030..9389f3daf 100644 --- a/modemdab/dabofdm.cpp +++ b/modemdab/dabofdm.cpp @@ -736,7 +736,7 @@ bool DABFrontEnd::processFrame() for (int n = ModeI::NullSize; n < ModeI::FrameSize; n += 7) { symbolPower += std::norm(m_mixed[Margin + shift + n]); } - symbolPower /= (ModeI::FrameSize - ModeI::NullSize) / 7; + symbolPower /= ((ModeI::FrameSize - ModeI::NullSize + 6) / 7.0); m_frame.startSample = frameStart + shift; m_frame.frequencyOffsetHz = static_cast(m_frequency); From 68585cac68f752d505631c1852703bfefea591c7 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 27 Oct 2026 20:09:26 -0400 Subject: [PATCH 04/34] modemdab: Avoid Coverity overflow warning in CRC16 Fix Coverity CID 657927 by explicitly limiting the complemented CRC to 16 bits using XOR with 0xffff. This avoids the reported overflow when returning the complemented value as uint16_t. Signed-off-by: Robin Getz --- modemdab/dabtables.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modemdab/dabtables.cpp b/modemdab/dabtables.cpp index 09b463ec5..896ac7605 100644 --- a/modemdab/dabtables.cpp +++ b/modemdab/dabtables.cpp @@ -446,7 +446,7 @@ uint16_t DABTables::crc16(const uint8_t *data, std::size_t length) crc = (crc & 0x8000) ? static_cast((crc << 1) ^ 0x1021) : static_cast(crc << 1); } } - return static_cast(~crc); + return static_cast(~crc ^ 0xffff); } bool DABTables::crc16Check(const uint8_t *data, std::size_t lengthWithCRC) From b34caee95ca9ab67c0e51039975a82f81eacdaf0 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 27 Oct 2026 20:11:54 -0400 Subject: [PATCH 05/34] modemdrm: Guard against missing spectrum parameters Fix Coverity CID 657650 by checking the result of Parameters::forSpectrum() before dereferencing it in estimateFrameWiener(). Return false if no spectrum parameters are available. Signed-off-by: Robin Getz --- modemdrm/drmchannelestimator.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modemdrm/drmchannelestimator.cpp b/modemdrm/drmchannelestimator.cpp index 50d2af43c..dbbbc4381 100644 --- a/modemdrm/drmchannelestimator.cpp +++ b/modemdrm/drmchannelestimator.cpp @@ -1578,6 +1578,9 @@ bool ChannelEstimationContext::estimateFrameWiener( const auto& fftFrames = *m_frames; const ModeParameters& parameters = Parameters::forMode(mode); const SpectrumParameters* spectrum = Parameters::forSpectrum(mode, occupancy); + if (!spectrum) { + return false; + } const int carrierCount = spectrum->maximumCarrier - spectrum->minimumCarrier + 1; const float temporalCorrelation = m_temporalCorrelation; const TemporalWeights weights = temporalWeights(temporalCorrelation); From 1afb509999ca53be844b12c70fe1af4882531249 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 27 Oct 2026 20:13:09 -0400 Subject: [PATCH 06/34] modemdvb: Fix data race in DVB-S2 deframing Fix Coverity CID 657456 by locking m_mutex before accessing slot.m_epoch and m_resetEpoch in Receiver::deframe(). This ensures the epoch check is synchronized with writes to slot.m_epoch. Signed-off-by: Robin Getz --- modemdvb/dvbs2receiver.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/modemdvb/dvbs2receiver.cpp b/modemdvb/dvbs2receiver.cpp index d81492e10..c7610fddf 100644 --- a/modemdvb/dvbs2receiver.cpp +++ b/modemdvb/dvbs2receiver.cpp @@ -948,6 +948,7 @@ void Receiver::deframe(FrameSlot& slot) // Not from a frame of before a reset (still being decoded when it came): the front end's set for the // signal since + std::lock_guard lock(m_mutex); if (slot.m_epoch == m_resetEpoch) { m_matypeRollOff = header.rollOff() + (m_lowRollOffs ? 4 : 0); } From 154e76b045b7214d03292f4c86a39a8a344fae77 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 27 Oct 2026 23:17:01 -0400 Subject: [PATCH 07/34] modemdvb: Fix negative shift in cell interleaver Fix Coverity CID 657550 by avoiding the shift when m_nd is zero. The previous expression could shift by -1, causing undefined behavior. Signed-off-by: Robin Getz --- modemdvb/dvbt2fec.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modemdvb/dvbt2fec.cpp b/modemdvb/dvbt2fec.cpp index abaffefac..7d4291e29 100644 --- a/modemdvb/dvbt2fec.cpp +++ b/modemdvb/dvbt2fec.cpp @@ -951,7 +951,7 @@ CellInterleaver::CellInterleaver(int ncells) : r = (r >> 1) | (bit << (m_nd - 2)); } - int value = (int) (((i & 1) << (m_nd - 1)) | r); + int value = m_nd > 0 ? (int) (((i & 1) << (m_nd - 1)) | r) : (int) r; if (value < ncells) { m_l0[q++] = value; From b2e6a5cc8a3f6cb12156272689e44270a0c61228 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 27 Oct 2026 23:21:02 -0400 Subject: [PATCH 08/34] modemdvb: Fix data races on input sample rate Fix Coverity CIDs 657466, 657471, and 657508 by protecting reads of m_inputRate with m_ofdmMutex. Copy the rate while holding the mutex and use the local copy outside the critical section. Signed-off-by: Robin Getz --- modemdvb/dvbtreceiver.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/modemdvb/dvbtreceiver.cpp b/modemdvb/dvbtreceiver.cpp index 7584ed1d0..72288df56 100644 --- a/modemdvb/dvbtreceiver.cpp +++ b/modemdvb/dvbtreceiver.cpp @@ -103,6 +103,8 @@ void Receiver::reset() m_ofdm.reset(); m_clockUpdateSymbols = 0; + std::vector notches; + double inputRate; { std::lock_guard lock(m_ofdmMutex); m_ofdmStatus = m_ofdm.getStatus(); @@ -120,9 +122,11 @@ void Receiver::reset() } m_notchesQueued = m_notchFrequencies; + notches = m_notchesQueued; + inputRate = m_inputRate; } - m_ofdm.setNotches(m_notchesQueued, m_inputRate); // The demodulator thread isn't running + m_ofdm.setNotches(notches, inputRate); // The demodulator thread isn't running if (m_threaded) { @@ -334,7 +338,12 @@ void Receiver::correctClock() m_resampling = true; m_resampler.setRatioCorrection(1.0); - m_resampler.configure(m_inputRate, m_outputRate, 0.4165 * m_outputRate); + double inputRate; + { + std::lock_guard lock(m_ofdmMutex); + inputRate = m_inputRate; + } + m_resampler.configure(inputRate, m_outputRate, 0.4165 * m_outputRate); m_resampler.prime(m_lastInput); setRatioCorrection(1.0 - ppm * 1e-6); // The measurement is accurate, so start with all of it return; From 4abed62ecc1ee5a7abed849a5505af4f66e1d604 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 27 Oct 2026 23:22:07 -0400 Subject: [PATCH 09/34] modemdvb: Document LDPCPool::cancel() locking requirement Document that callers must hold m_mutex when calling LDPCPool::cancel(). This clarifies the locking contract and addresses the Coverity finding as a false positive. Signed-off-by: Robin Getz --- modemdvb/ldpcpool.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/modemdvb/ldpcpool.cpp b/modemdvb/ldpcpool.cpp index 720ffbc0a..4ba94484c 100644 --- a/modemdvb/ldpcpool.cpp +++ b/modemdvb/ldpcpool.cpp @@ -156,6 +156,7 @@ void LDPCPool::run(Job& job, Context& context) } } +// Caller must hold m_mutex. void LDPCPool::cancel(Job& job) { job.m_done += job.m_batches - job.m_next; From acd3af86ab8d8440426d8b06acffa3c55d08f653 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 27 Oct 2026 23:23:13 -0400 Subject: [PATCH 10/34] modemm17: Restore ostream format after printing AX.25 PID Fix Coverity CID 655956 by saving and restoring the stream format flags around the hexadecimal PID output. This prevents the basefield setting from affecting subsequent output. Signed-off-by: Robin Getz --- modemm17/ax25_frame.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modemm17/ax25_frame.h b/modemm17/ax25_frame.h index 3a8d52388..111d0f0be 100644 --- a/modemm17/ax25_frame.h +++ b/modemm17/ax25_frame.h @@ -256,7 +256,9 @@ void write(std::ostream& os, const ax25_frame& frame) if (frame.pid()) { + std::ios_base::fmtflags flags = os.flags(); os << "PID: " << std::setbase(16) << int(frame.pid()) << std::endl; + os.flags(flags); } os << "Info: " << std::endl << frame.info() << std::endl; } From 321518f456eaf5c1fae9605e643f7236d244f9ab Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 27 Oct 2026 23:24:47 -0400 Subject: [PATCH 11/34] plugins/channelrx/demoddatv: Guard against null demodulator in tick() Fix Coverity CID 649227 by returning early from tick() when m_datvDemod is null. This prevents subsequent calls such as audioActive() from dereferencing a null pointer. Signed-off-by: Robin Getz --- plugins/channelrx/demoddatv/datvdemodgui.cpp | 61 +++++++++++--------- 1 file changed, 35 insertions(+), 26 deletions(-) diff --git a/plugins/channelrx/demoddatv/datvdemodgui.cpp b/plugins/channelrx/demoddatv/datvdemodgui.cpp index fca3066fe..bd0bf661e 100644 --- a/plugins/channelrx/demoddatv/datvdemodgui.cpp +++ b/plugins/channelrx/demoddatv/datvdemodgui.cpp @@ -547,39 +547,48 @@ void DATVDemodGUI::ldpcToolSelect(const QPoint& p) void DATVDemodGUI::tick() { - if (m_datvDemod) + if((m_intLastDecodedData - m_intPreviousDecodedData)>=0) { - m_objMagSqAverage(m_datvDemod->getMagSq()); - double magSqDB = CalcDb::dbPower(m_objMagSqAverage / (SDR_RX_SCALED*SDR_RX_SCALED)); - ui->channePowerText->setText(tr("%1 dB").arg(magSqDB, 0, 'f', 1)); + m_intLastSpeed = 8 * (m_intLastDecodedData - m_intPreviousDecodedData); + ui->lblRate->setText(QString("Speed: %1b/s").arg(formatBytes(m_intLastSpeed))); + } - if ((m_modcodModulationIndex != m_datvDemod->getModcodModulation()) || (m_modcodCodeRateIndex != m_datvDemod->getModcodCodeRate())) - { - m_modcodModulationIndex = m_datvDemod->getModcodModulation(); - m_modcodCodeRateIndex = m_datvDemod->getModcodCodeRate(); - DATVDemodSettings::DATVModulation modulation = DATVDemodSettings::getModulationFromLeanDVBCode(m_modcodModulationIndex); - DATVDemodSettings::DATVCodeRate rate = DATVDemodSettings::getCodeRateFromLeanDVBCode(m_modcodCodeRateIndex); - QString modcodModulationStr = DATVDemodSettings::getStrFromModulation(modulation); - QString modcodCodeRateStr = DATVDemodSettings::getStrFromCodeRate(rate); - ui->statusText->setText(tr("MCOD %1 %2").arg(modcodModulationStr).arg(modcodCodeRateStr)); - } + if (!m_datvDemod) + { + ui->audioMute->setStyleSheet("QToolButton { background:rgb(79,79,79); }"); + ui->videoMute->setStyleSheet("QToolButton { background:rgb(79,79,79); }"); + ui->playerIndicator->setStyleSheet("QLabel { background-color: gray; border-radius: 8px; }"); + ui->udpIndicator->setStyleSheet("QLabel { background-color: gray; border-radius: 8px; }"); + ui->channePowerText->setText("---"); + ui->statusText->setText("---"); + ui->statusText->setStyleSheet("QLabel { background:rgb(79,79,79); }"); + return; + } - if (m_cstlnSetByModcod != m_datvDemod->isCstlnSetByModcod()) - { - m_cstlnSetByModcod = m_datvDemod->isCstlnSetByModcod(); + m_objMagSqAverage(m_datvDemod->getMagSq()); + double magSqDB = CalcDb::dbPower(m_objMagSqAverage / (SDR_RX_SCALED*SDR_RX_SCALED)); + ui->channePowerText->setText(tr("%1 dB").arg(magSqDB, 0, 'f', 1)); - if (m_cstlnSetByModcod) { - ui->statusText->setStyleSheet("QLabel { background-color : green; }"); - } else { - ui->statusText->setStyleSheet("QLabel { background:rgb(79,79,79); }"); - } - } + if ((m_modcodModulationIndex != m_datvDemod->getModcodModulation()) || (m_modcodCodeRateIndex != m_datvDemod->getModcodCodeRate())) + { + m_modcodModulationIndex = m_datvDemod->getModcodModulation(); + m_modcodCodeRateIndex = m_datvDemod->getModcodCodeRate(); + DATVDemodSettings::DATVModulation modulation = DATVDemodSettings::getModulationFromLeanDVBCode(m_modcodModulationIndex); + DATVDemodSettings::DATVCodeRate rate = DATVDemodSettings::getCodeRateFromLeanDVBCode(m_modcodCodeRateIndex); + QString modcodModulationStr = DATVDemodSettings::getStrFromModulation(modulation); + QString modcodCodeRateStr = DATVDemodSettings::getStrFromCodeRate(rate); + ui->statusText->setText(tr("MCOD %1 %2").arg(modcodModulationStr).arg(modcodCodeRateStr)); } - if((m_intLastDecodedData-m_intPreviousDecodedData)>=0) + if (m_cstlnSetByModcod != m_datvDemod->isCstlnSetByModcod()) { - m_intLastSpeed = 8*(m_intLastDecodedData-m_intPreviousDecodedData); - ui->lblRate->setText(QString("Speed: %1b/s").arg(formatBytes(m_intLastSpeed))); + m_cstlnSetByModcod = m_datvDemod->isCstlnSetByModcod(); + + if (m_cstlnSetByModcod) { + ui->statusText->setStyleSheet("QLabel { background-color : green; }"); + } else { + ui->statusText->setStyleSheet("QLabel { background:rgb(79,79,79); }"); + } } if (m_datvDemod->audioActive()) From 5f05876c5429038a16ecf33f37268094244b1706 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 27 Oct 2026 23:26:21 -0400 Subject: [PATCH 12/34] plugins/channelrx/demoddatv: Guard against oversized shift in deconvolution Fix Coverity CID 652479 by checking whether nprefix reaches the bit width of iq_t before shifting response[b]. This avoids undefined behavior from shifting by the type width or more. Signed-off-by: Robin Getz --- plugins/channelrx/demoddatv/leansdr/dvb.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/channelrx/demoddatv/leansdr/dvb.h b/plugins/channelrx/demoddatv/leansdr/dvb.h index 9ef342e95..4038cb99a 100644 --- a/plugins/channelrx/demoddatv/leansdr/dvb.h +++ b/plugins/channelrx/demoddatv/leansdr/dvb.h @@ -260,9 +260,11 @@ struct deconvol_sync : runnable if (parity(prefix & response[b]) != ((exp >> b) & 1)) { // Current candidate does not solve this column. - if ((response[b] >> nprefix) == 0) + if (nprefix >= sizeof(iq_t) * 8 || (response[b] >> nprefix) == 0) + { // No more bits to trace back. return; + } solved = 0; } } From b86f8e8a1d1a5d6f7ef51dfaf47d1f821eb7c6ea Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 27 Oct 2026 23:27:31 -0400 Subject: [PATCH 13/34] plugins/channelrx/demodm17: Avoid negative indexing in checksum extraction Fix Coverity CID 655947 by replacing end()[-2] with an explicit size-based index when extracting the transmitted checksum. This avoids passing a negative index to the container access expression. Signed-off-by: Robin Getz --- plugins/channelrx/demodm17/m17demodprocessor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/channelrx/demodm17/m17demodprocessor.cpp b/plugins/channelrx/demodm17/m17demodprocessor.cpp index 72d2c7908..fc212d67a 100644 --- a/plugins/channelrx/demodm17/m17demodprocessor.cpp +++ b/plugins/channelrx/demodm17/m17demodprocessor.cpp @@ -344,7 +344,7 @@ bool M17DemodProcessor::decode_packet(modemm17::M17FrameDecoder::packet_buffer_t } uint16_t calcChecksum = crc16.get_bytes()[1] + (crc16.get_bytes()[0]<<8); - uint16_t xmitChecksum = m_currentPacket.back() + (m_currentPacket.end()[-2]<<8); + uint16_t xmitChecksum = m_currentPacket.back() + (m_currentPacket[m_currentPacket.size() - 2] << 8); if (calcChecksum == xmitChecksum) // (checksum == 0x0f47) { From 4806f20d03cd006720b7f558492417d1b4f27469 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 27 Oct 2026 23:29:44 -0400 Subject: [PATCH 14/34] plugins/channelrx/demodwefax: Clamp FFT bin indices Fix Coverity CID 657025 by clamping the bin indices returned by binOf() to the valid FFT range before accessing the spectrum. This prevents out-of-range indexing when the calculated bin is negative or exceeds the spectrum bounds. Signed-off-by: Robin Getz --- plugins/channelrx/demodwefax/wefaxtonemeter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/channelrx/demodwefax/wefaxtonemeter.cpp b/plugins/channelrx/demodwefax/wefaxtonemeter.cpp index 974b8c4b5..15b1fc061 100644 --- a/plugins/channelrx/demodwefax/wefaxtonemeter.cpp +++ b/plugins/channelrx/demodwefax/wefaxtonemeter.cpp @@ -97,7 +97,7 @@ void WefaxToneMeter::evaluate() const double halfWidth = 0.25 * m_shiftHz; for (double hz = centreHz - halfWidth; hz <= centreHz + halfWidth; hz += binHz) { - const int bin = binOf(hz); + const int bin = std::clamp(binOf(hz), 0, FFTSize - 1); const double power = m_spectrum[bin]; if ((power > 10.0 * median) && (power > m_spectrum[(bin + FFTSize - 1) % FFTSize]) @@ -140,7 +140,7 @@ void WefaxToneMeter::evaluate() // Parabolic interpolation on log power refines each peak within a bin. const auto refine = [&](double hz) { - const int bin = binOf(hz); + const int bin = std::clamp(binOf(hz), 0, FFTSize - 1); const double left = std::log(m_spectrum[(bin + FFTSize - 1) % FFTSize]); const double centre = std::log(m_spectrum[bin]); const double right = std::log(m_spectrum[(bin + 1) % FFTSize]); From f470949674e84c4cc0496353c1f01c480b7be45a Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 27 Oct 2026 23:30:54 -0400 Subject: [PATCH 15/34] plugins/channelrx/freqtracker: Fix applyChannelSettings argument order Fix Coverity CID 652454 by passing m_sinkSampleRate, m_channelSampleRate, and m_inputFrequencyOffset in the order expected by applyChannelSettings(). Signed-off-by: Robin Getz --- plugins/channelrx/freqtracker/freqtrackersink.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/channelrx/freqtracker/freqtrackersink.cpp b/plugins/channelrx/freqtracker/freqtrackersink.cpp index ca954287b..409852ea1 100644 --- a/plugins/channelrx/freqtracker/freqtrackersink.cpp +++ b/plugins/channelrx/freqtracker/freqtrackersink.cpp @@ -63,7 +63,7 @@ FreqTrackerSink::FreqTrackerSink() : m_rrcFilter = new FIRFilterRRC(); m_rrcFilter->create(m_settings.m_rfBandwidth / m_sinkSampleRate, m_settings.m_rrcRolloff / 100.0f, 8, FIRFilterRRC::Normalization::Energy); m_pll.computeCoefficients(0.002f, 0.5f, 10.0f); // bandwidth, damping factor, loop gain - applyChannelSettings(m_channelSampleRate, m_inputFrequencyOffset, true); + applyChannelSettings(m_sinkSampleRate, m_channelSampleRate, m_inputFrequencyOffset, true); } FreqTrackerSink::~FreqTrackerSink() From b56c36fed5da00f0dfb5b51c87af2dada0f93557 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 27 Oct 2026 23:33:08 -0400 Subject: [PATCH 16/34] plugins/channelrx/remotetcpsink: Fix message buffer overrun Fix Coverity CID 652660 by allocating an extra byte for the message buffer and null-terminating it after a successful read. This ensures QString::fromUtf8() does not read beyond the received message. Signed-off-by: Robin Getz --- plugins/channelrx/remotetcpsink/remotetcpsinksink.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/channelrx/remotetcpsink/remotetcpsinksink.cpp b/plugins/channelrx/remotetcpsink/remotetcpsinksink.cpp index 46e629095..f57d00700 100644 --- a/plugins/channelrx/remotetcpsink/remotetcpsinksink.cpp +++ b/plugins/channelrx/remotetcpsink/remotetcpsinksink.cpp @@ -1213,10 +1213,11 @@ void RemoteTCPSinkSink::processCommand() quint32 msgLen = RemoteTCPProtocol::extractUInt32(&cmd[1]); try { - char *buf = new char[msgLen]; + char *buf = new char[msgLen + 1]; len = client->read((char *)buf, msgLen); if (len == (int) msgLen && msgLen) { + buf[msgLen] = '\0'; bool broadcast = (bool) buf[0]; int i; for (i = 1; i < (int) msgLen; i++) From 4d4489f4f91004c9bc128c984682e33a1d0b42a4 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 27 Oct 2026 23:34:07 -0400 Subject: [PATCH 17/34] plugins/channeltx/moddatv: Guard channel power report access Fix Coverity CID 652458 by moving the getMagSq() call inside the m_basebandSource null check, avoiding access to the baseband source when it is unavailable. Signed-off-by: Robin Getz --- plugins/channeltx/moddatv/datvmod.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/channeltx/moddatv/datvmod.cpp b/plugins/channeltx/moddatv/datvmod.cpp index 924974a78..000bf27e7 100644 --- a/plugins/channeltx/moddatv/datvmod.cpp +++ b/plugins/channeltx/moddatv/datvmod.cpp @@ -561,12 +561,12 @@ void DATVMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respo void DATVMod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response) { - response.getDatvModReport()->setChannelPowerDb(CalcDb::dbPower(getMagSq())); int tsBitrate = 0, tsSize = 0, channelSampleRate = 0, dataRate = 0; int64_t udpBytes = 0; if (m_basebandSource) { + response.getDatvModReport()->setChannelPowerDb(CalcDb::dbPower(getMagSq())); channelSampleRate = m_basebandSource->getChannelSampleRate(); m_basebandSource->geTsFileInfos(tsBitrate, tsSize); udpBytes = m_basebandSource->getUdpByteCount(); From 30ee35595da1780009c5b4b513b06030fc962906 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 27 Oct 2026 23:36:58 -0400 Subject: [PATCH 18/34] plugins/feature/aprs: Fix copy-paste error in message column settings Fix Coverity CID 652244 by clearing the message table column indexes instead of the status table column sizes when reversing APRS message table settings. Signed-off-by: Robin Getz --- plugins/feature/aprs/aprs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/feature/aprs/aprs.cpp b/plugins/feature/aprs/aprs.cpp index 6eef6410a..c3941b71d 100644 --- a/plugins/feature/aprs/aprs.cpp +++ b/plugins/feature/aprs/aprs.cpp @@ -896,7 +896,7 @@ void APRS::webapiReverseSendSettings(const QList& featureSettingsKeys, swgAPRSSettings->setMessagesTableColumnIndexes(new QList()); } - swgAPRSSettings->getStatusTableColumnSizes()->clear(); + swgAPRSSettings->getMessagesTableColumnIndexes()->clear(); for (int i = 0; i < APRS_MESSAGES_TABLE_COLUMNS; i++) { swgAPRSSettings->getMessagesTableColumnIndexes()->push_back(settings.m_messagesTableColumnIndexes[i]); From d5f0c19d267311d336686f9091383510554d0806 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 27 Oct 2026 23:38:07 -0400 Subject: [PATCH 19/34] plugins/feature/sid: Guard against null channel in getChannels() Fix Coverity CID 652299 by checking the result of mainCore->getChannel() before passing it to getChannelId(). Skip the channel if the lookup returns nullptr. Signed-off-by: Robin Getz --- plugins/feature/sid/sidsettings.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/feature/sid/sidsettings.cpp b/plugins/feature/sid/sidsettings.cpp index a3e051f84..9dfc44df0 100644 --- a/plugins/feature/sid/sidsettings.cpp +++ b/plugins/feature/sid/sidsettings.cpp @@ -645,6 +645,9 @@ void SIDSettings::getChannels(QStringList& ids, QStringList& titles) if (ChannelWebAPIUtils::getChannelReportValue(deviceSetIndex, channelIndex, "channelPowerDB", power)) { ChannelAPI *channel = mainCore->getChannel(deviceSetIndex, channelIndex); + if (!channel) { + continue; + } QString id = mainCore->getChannelId(channel); From cdef890433327e488fc7ca264b84c8daa5092cf5 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 27 Oct 2026 23:39:01 -0400 Subject: [PATCH 20/34] plugins/samplemimo/audiocatsiso: Guard against null input worker Fix Coverity CID 655949 by checking that m_inputWorker is non-null before dereferencing it. Signed-off-by: Robin Getz --- plugins/samplemimo/audiocatsiso/audiocatsiso.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/samplemimo/audiocatsiso/audiocatsiso.cpp b/plugins/samplemimo/audiocatsiso/audiocatsiso.cpp index 59bbd7e2d..025d6cb40 100644 --- a/plugins/samplemimo/audiocatsiso/audiocatsiso.cpp +++ b/plugins/samplemimo/audiocatsiso/audiocatsiso.cpp @@ -549,7 +549,7 @@ void AudioCATSISO::applySettings(const AudioCATSISOSettings& settings, const QLi { forwardRxChange = true; - if (m_rxRunning) { + if (m_rxRunning && m_inputWorker) { m_inputWorker->setIQMapping(settings.m_rxIQMapping); } } From 3c5d885e53045af34dbce80893191b4358514a28 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 27 Oct 2026 23:40:32 -0400 Subject: [PATCH 21/34] plugins/samplemimo/audiocatsiso: Return when rig initialization fails Fix Coverity CID 655933 by returning from catConnect() when rig_init() fails, preventing subsequent dereferences of a null m_rig pointer. Signed-off-by: Robin Getz --- plugins/samplemimo/audiocatsiso/audiocatsisocatworker.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/samplemimo/audiocatsiso/audiocatsisocatworker.cpp b/plugins/samplemimo/audiocatsiso/audiocatsisocatworker.cpp index f210faa1e..1b0113322 100644 --- a/plugins/samplemimo/audiocatsiso/audiocatsisocatworker.cpp +++ b/plugins/samplemimo/audiocatsiso/audiocatsisocatworker.cpp @@ -226,11 +226,10 @@ void AudioCATSISOCATWorker::catConnect() ); m_inputMessageQueueToGUI->push(msg); } + return; } - else - { - qDebug("AudioCATSISOCATWorker::catConnect: rig initialized with num: %u", m_settings.m_hamlibModel); - } + + qDebug("AudioCATSISOCATWorker::catConnect: rig initialized with num: %u", m_settings.m_hamlibModel); m_rig->state.rigport.type.rig = RIG_PORT_SERIAL; m_rig->state.rigport.parm.serial.rate = AudioCATSISOSettings::m_catSpeeds[m_settings.m_catSpeedIndex]; From 3dd928ab3b0efbb3eafc324848cdf9ce9f02fd97 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 27 Oct 2026 23:41:47 -0400 Subject: [PATCH 22/34] plugins/samplemimo/plutosdrmimo: Guard against null PlutoSDR device Fix Coverity CID 652457 by checking that `plutoBox` is non-null before calling `setFIR()`. Also guard parameter updates and device queries against a missing PlutoSDR box at the same time. Signed-off-by: Robin Getz --- .../samplemimo/plutosdrmimo/plutosdrmimo.cpp | 89 +++++++------------ 1 file changed, 30 insertions(+), 59 deletions(-) diff --git a/plugins/samplemimo/plutosdrmimo/plutosdrmimo.cpp b/plugins/samplemimo/plutosdrmimo/plutosdrmimo.cpp index 2094f710c..3156ecb49 100644 --- a/plugins/samplemimo/plutosdrmimo/plutosdrmimo.cpp +++ b/plugins/samplemimo/plutosdrmimo/plutosdrmimo.cpp @@ -680,11 +680,11 @@ bool PlutoSDRMIMO::applySettings(const PlutoSDRMIMOSettings& settings, const QLi // Tx // Change affecting device sample rate chain and other buddies - if (settingsKeys.contains("devSampleRate") || + if (plutoBox && (settingsKeys.contains("devSampleRate") || settingsKeys.contains("lpfTxFIREnable") || settingsKeys.contains("lpfTxFIRlog2Interp") || settingsKeys.contains("lpfTxFIRBW") || - settingsKeys.contains("lpfTxFIRGain") || force) + settingsKeys.contains("lpfTxFIRGain") || force)) { plutoBox->setFIR( settings.m_devSampleRate, @@ -779,7 +779,7 @@ bool PlutoSDRMIMO::applySettings(const PlutoSDRMIMOSettings& settings, const QLi paramsToSet = true; } - if (paramsToSet) { + if (plutoBox && paramsToSet) { plutoBox->set_params(DevicePlutoSDRBox::DEVICE_PHY, params); } @@ -1343,13 +1343,9 @@ void PlutoSDRMIMO::getRxRSSI(std::string& rssiStr, int chan) return; } - if (m_plutoParams) - { - DevicePlutoSDRBox *plutoBox = m_plutoParams->getBox(); - - if (!plutoBox->getRxRSSI(rssiStr, chan)) { - rssiStr = "xxx dB"; - } + DevicePlutoSDRBox *plutoBox = m_plutoParams ? m_plutoParams->getBox() : nullptr; + if (plutoBox && !plutoBox->getRxRSSI(rssiStr, chan)) { + rssiStr = "xxx dB"; } } @@ -1361,15 +1357,10 @@ void PlutoSDRMIMO::getTxRSSI(std::string& rssiStr, int chan) return; } - if (m_plutoParams) - { - DevicePlutoSDRBox *plutoBox = m_plutoParams->getBox(); - - if (!plutoBox->getTxRSSI(rssiStr, chan)) { - rssiStr = "xxx dB"; - } + DevicePlutoSDRBox *plutoBox = m_plutoParams ? m_plutoParams->getBox() : nullptr; + if (plutoBox && !plutoBox->getTxRSSI(rssiStr, chan)) { + rssiStr = "xxx dB"; } - } void PlutoSDRMIMO::getRxGain(int& gaindB, int chan) @@ -1380,13 +1371,9 @@ void PlutoSDRMIMO::getRxGain(int& gaindB, int chan) return; } - if (m_plutoParams) - { - DevicePlutoSDRBox *plutoBox = m_plutoParams->getBox(); - - if (!plutoBox->getRxGain(gaindB, chan)) { - gaindB = 0; - } + DevicePlutoSDRBox *plutoBox = m_plutoParams ? m_plutoParams->getBox() : nullptr; + if (plutoBox && !plutoBox->getRxGain(gaindB, chan)) { + gaindB = 0; } } @@ -1398,17 +1385,13 @@ void PlutoSDRMIMO::getbbLPRange(quint32& minLimit, quint32& maxLimit) return; } - if (m_plutoParams) + DevicePlutoSDRBox *plutoBox = m_plutoParams ? m_plutoParams->getBox() : nullptr; + if (plutoBox) { - DevicePlutoSDRBox *plutoBox = m_plutoParams->getBox(); - - if (plutoBox) - { - uint32_t min, max; - plutoBox->getbbLPRxRange(min, max); - minLimit = min; - maxLimit = max; - } + uint32_t min, max; + plutoBox->getbbLPRxRange(min, max); + minLimit = min; + maxLimit = max; } } @@ -1420,17 +1403,13 @@ void PlutoSDRMIMO::getLORange(qint64& minLimit, qint64& maxLimit) return; } - if (m_plutoParams) + DevicePlutoSDRBox *plutoBox = m_plutoParams ? m_plutoParams->getBox() : nullptr; + if (plutoBox) { - DevicePlutoSDRBox *plutoBox = m_plutoParams->getBox(); - - if (plutoBox) - { - uint64_t min, max; - plutoBox->getRxLORange(min, max); - minLimit = min; - maxLimit = max; - } + uint64_t min, max; + plutoBox->getRxLORange(min, max); + minLimit = min; + maxLimit = max; } } @@ -1442,13 +1421,9 @@ bool PlutoSDRMIMO::fetchTemperature() return false; } - if (m_plutoParams) - { - DevicePlutoSDRBox *plutoBox = m_plutoParams->getBox(); - - if (plutoBox) { - return plutoBox->fetchTemp(); - } + DevicePlutoSDRBox *plutoBox = m_plutoParams ? m_plutoParams->getBox() : nullptr; + if (plutoBox) { + return plutoBox->fetchTemp(); } return false; @@ -1462,13 +1437,9 @@ float PlutoSDRMIMO::getTemperature() return 0.0; } - if (m_plutoParams) - { - DevicePlutoSDRBox *plutoBox = m_plutoParams->getBox(); - - if (plutoBox) { - return plutoBox->getTemp(); - } + DevicePlutoSDRBox *plutoBox = m_plutoParams ? m_plutoParams->getBox() : nullptr; + if (plutoBox) { + return plutoBox->getTemp(); } return 0.0; From b1b79b8d127da8aa096444792a2b7d2c032ddab6 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 27 Oct 2026 23:43:36 -0400 Subject: [PATCH 23/34] plugins/samplesource/audioinput: Guard against null worker Fix Coverity CID 652538 by checking that `m_worker` is non-null before dereferencing it. Signed-off-by: Robin Getz --- plugins/samplesource/audioinput/audioinput.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/samplesource/audioinput/audioinput.cpp b/plugins/samplesource/audioinput/audioinput.cpp index 7c0d81934..ba4e1c624 100644 --- a/plugins/samplesource/audioinput/audioinput.cpp +++ b/plugins/samplesource/audioinput/audioinput.cpp @@ -297,7 +297,7 @@ void AudioInput::applySettings(const AudioInputSettings& settings, QListsetIQMapping(settings.m_iqMapping); } } From c6f577af146f4614e21ebb9c15908a0096ff3b33 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 27 Oct 2026 23:45:11 -0400 Subject: [PATCH 24/34] plugins/samplesource/remotetcpinput: Fix message buffer overrun Fix Coverity CID 652555 by allocating an extra byte and null-terminating the message buffer. Guard text extraction when the delimiter is absent to avoid reading beyond the buffer. Signed-off-by: Robin Getz --- .../remotetcpinput/remotetcpinputtcphandler.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/samplesource/remotetcpinput/remotetcpinputtcphandler.cpp b/plugins/samplesource/remotetcpinput/remotetcpinputtcphandler.cpp index 5748851a5..05cf5bdf4 100644 --- a/plugins/samplesource/remotetcpinput/remotetcpinputtcphandler.cpp +++ b/plugins/samplesource/remotetcpinput/remotetcpinputtcphandler.cpp @@ -1948,11 +1948,12 @@ void RemoteTCPInputTCPHandler::processCommands() case RemoteTCPProtocol::sendMessage: { - char *buf = new char[m_commandLength]; + char *buf = new char[m_commandLength + 1]; qint64 bytesRead = m_dataSocket->read(buf, m_commandLength); if (bytesRead == m_commandLength) { + buf[m_commandLength] = '\0'; bool broadcast = (bool) buf[0]; int i; for (i = 1; i < (int) m_commandLength; i++) @@ -1962,7 +1963,9 @@ void RemoteTCPInputTCPHandler::processCommands() } } QString callsign = QString::fromUtf8(&buf[1]); - QString text = QString::fromUtf8(&buf[i+1]); + QString text = (i < (int) m_commandLength) + ? QString::fromUtf8(&buf[i+1]) + : QString(); qDebug() << "RemoteTCPInputTCPHandler::processCommands: Message " << m_dataSocket->peerAddress() << m_dataSocket->peerPort() << callsign << broadcast << text; if (m_messageQueueToGUI) { From a7edeafc9b55e8f60a4948fd65fdd82bac051c7a Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 27 Oct 2026 23:46:33 -0400 Subject: [PATCH 25/34] plugins/samplesource/sdrplayv3: Guard against null SDRplay thread Fix Coverity CID 655966 by checking that `m_sdrPlayThread` is non-null before calling `setDeviceCenterFrequency()`. Signed-off-by: Robin Getz --- plugins/samplesource/sdrplayv3/sdrplayv3input.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/samplesource/sdrplayv3/sdrplayv3input.cpp b/plugins/samplesource/sdrplayv3/sdrplayv3input.cpp index acf5951f3..fb2f96fe3 100644 --- a/plugins/samplesource/sdrplayv3/sdrplayv3input.cpp +++ b/plugins/samplesource/sdrplayv3/sdrplayv3input.cpp @@ -474,7 +474,7 @@ bool SDRPlayV3Input::applySettings(const SDRPlayV3Settings& settings, const QLis forwardChange = true; - if (m_running) + if (m_running && m_sdrPlayThread) { if (setDeviceCenterFrequency(deviceCenterFrequency)) { qDebug() << "SDRPlayV3Input::applySettings: center freq: " << settings.m_centerFrequency << " Hz"; From cdfe0a7130a87aaeae6793f573299eaf897a2428 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 27 Oct 2026 23:49:51 -0400 Subject: [PATCH 26/34] sdrbase/channel: Guard against null Web API error messages Fix Coverity CIDs 652172, 652242, 652256, 652288, 652572, 652666, and 652679 by checking error message pointers before dereferencing them. Use "Unknown error" when no message is available. Also use Printable for the successful channel setting debug log. Signed-off-by: Robin Getz --- sdrbase/channel/channelwebapiutils.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/sdrbase/channel/channelwebapiutils.cpp b/sdrbase/channel/channelwebapiutils.cpp index 6731f00b7..dd2fdaf7b 100644 --- a/sdrbase/channel/channelwebapiutils.cpp +++ b/sdrbase/channel/channelwebapiutils.cpp @@ -397,8 +397,9 @@ bool ChannelWebAPIUtils::setCenterFrequency(unsigned int deviceIndex, double fre } else { + QString *message = errorResponse2.getMessage(); qWarning("ChannelWebAPIUtils::setCenterFrequency: set device frequency error %d: %s", - httpRC, qPrintable(*errorResponse2.getMessage())); + httpRC, message ? qPrintable(*message) : "Unknown error"); return false; } } @@ -1444,8 +1445,9 @@ bool ChannelWebAPIUtils::patchDeviceSetting(unsigned int deviceIndex, const QStr } else { + QString *message = errorResponse2.getMessage(); qWarning("ChannelWebAPIUtils::patchDeviceSetting: set device setting error %d: %s", - httpRC, qPrintable(*errorResponse2.getMessage())); + httpRC, message ? qPrintable(*message) : "Unknown error"); return false; } } @@ -1501,8 +1503,9 @@ bool ChannelWebAPIUtils::patchDeviceSetting(unsigned int deviceIndex, const QStr } else { + QString *message = errorResponse2.getMessage(); qWarning("ChannelWebAPIUtils::patchDeviceSetting: set device setting error %d: %s", - httpRC, qPrintable(*errorResponse2.getMessage())); + httpRC, message ? qPrintable(*message) : "Unknown error"); return false; } } @@ -1550,8 +1553,9 @@ bool ChannelWebAPIUtils::patchFeatureSetting(unsigned int featureSetIndex, unsig } else { + QString *message = errorResponse2.getMessage(); qWarning("ChannelWebAPIUtils::patchFeatureSetting: set feature setting %s to %s error %d: %s", - qPrintable(setting), qPrintable(value), httpRC, qPrintable(*errorResponse2.getMessage())); + qPrintable(setting), qPrintable(value), httpRC, message ? qPrintable(*message) : "Unknown error"); return false; } } @@ -1599,8 +1603,9 @@ bool ChannelWebAPIUtils::patchFeatureSetting(unsigned int featureSetIndex, unsig } else { + QString *message = errorResponse2.getMessage(); qWarning("ChannelWebAPIUtils::patchFeatureSetting: set feature setting %s to %f error %d: %s", - qPrintable(setting), value, httpRC, qPrintable(*errorResponse2.getMessage())); + qPrintable(setting), value, httpRC, message ? qPrintable(*message) : "Unknown error"); return false; } } @@ -1680,8 +1685,9 @@ bool ChannelWebAPIUtils::patchFeatureSetting(unsigned int featureSetIndex, unsig } else { + QString *message = errorResponse2.getMessage(); qWarning("ChannelWebAPIUtils::patchFeatureSetting: set feature setting %s error %d: %s", - qPrintable(setting), httpRC, qPrintable(*errorResponse2.getMessage())); + qPrintable(setting), httpRC, message ? qPrintable(*message) : "Unknown error"); return false; } } @@ -1720,8 +1726,9 @@ bool ChannelWebAPIUtils::patchChannelSetting(ChannelAPI *channel, const QString } else { + QString *message = errorResponse2.getMessage(); qWarning("ChannelWebAPIUtils::patchChannelSetting: set feature setting %s to %s error %d: %s", - qPrintable(setting), qPrintable(value.toString()), httpRC, qPrintable(*errorResponse2.getMessage())); + qPrintable(setting), qPrintable(value.toString()), httpRC, message ? qPrintable(*message) : "Unknown error"); return false; } } @@ -1834,8 +1841,9 @@ bool ChannelWebAPIUtils::patchChannelSetting(unsigned int deviceSetIndex, unsign } else { + QString *message = errorResponse2.getMessage(); qWarning("ChannelWebAPIUtils::patchChannelSetting: set channel setting error %d: %s", - httpRC, qPrintable(*errorResponse2.getMessage())); + httpRC, message ? qPrintable(*message) : "Unknown error"); return false; } } From b6aff27ebd3b17c5cc8015058e4ecfdd8a370df4 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 27 Oct 2026 23:51:24 -0400 Subject: [PATCH 27/34] sdrbase/dsp: Fix copy-paste error in inverse FFT preallocation Fix Coverity CID 652581 by calling setReuse(false) on the inverse FFT engine instead of the forward FFT engine. Signed-off-by: Robin Getz --- sdrbase/dsp/fftfactory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdrbase/dsp/fftfactory.cpp b/sdrbase/dsp/fftfactory.cpp index 28e5804ea..84427d1a9 100644 --- a/sdrbase/dsp/fftfactory.cpp +++ b/sdrbase/dsp/fftfactory.cpp @@ -65,7 +65,7 @@ void FFTFactory::preallocate( { invFFTEngines.push_back(AllocatedEngine()); invFFTEngines.back().m_engine = FFTEngine::create(m_fftwWisdomFileName); - fftEngines.back().m_engine->setReuse(false); + invFFTEngines.back().m_engine->setReuse(false); invFFTEngines.back().m_engine->configure(fftSize, true); } } From 9d864f70b44c87bff8c69c16f47a03525707e087 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 27 Oct 2026 23:52:29 -0400 Subject: [PATCH 28/34] sdrbase/dsp: Fix WAV tag string length encoding Fix Coverity CIDs 652357 and 652459 by using a 32-bit length for tag strings and appending the full string without truncating it to the previous 16-bit length. Signed-off-by: Robin Getz --- sdrbase/dsp/wavfilerecord.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdrbase/dsp/wavfilerecord.cpp b/sdrbase/dsp/wavfilerecord.cpp index bfcfca77a..099ef8dd4 100644 --- a/sdrbase/dsp/wavfilerecord.cpp +++ b/sdrbase/dsp/wavfilerecord.cpp @@ -220,13 +220,13 @@ void addString(QByteArray& buffer, const QString& type, const QString text) s.append('\0'); } - quint16 textSize = s.size(); + quint32 textSize = s.size(); buffer.append(textSize & 0xff); buffer.append((textSize >> 8) & 0xff); buffer.append((textSize >> 16) & 0xff); buffer.append((textSize >> 24) & 0xff); - buffer.append(s, textSize); + buffer.append(s); } void addTag(QByteArray& buffer, const QString& id, const QString text) From cae296d8e3d416ca003bbb1931b7053e290213f3 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 27 Oct 2026 23:55:12 -0400 Subject: [PATCH 29/34] sdrbase/util: Handle unknown replies in downloadFinished() Fix Coverity CID 652510 by handling replies missing from m_downloads. This error case could cause an invalid index into m_filenames. Log a warning, schedule the reply for deletion, and return. Signed-off-by: Robin Getz --- sdrbase/util/httpdownloadmanager.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sdrbase/util/httpdownloadmanager.cpp b/sdrbase/util/httpdownloadmanager.cpp index f98da9cd3..bb0a980a2 100644 --- a/sdrbase/util/httpdownloadmanager.cpp +++ b/sdrbase/util/httpdownloadmanager.cpp @@ -123,6 +123,11 @@ void HttpDownloadManager::downloadFinished(QNetworkReply *reply) { QString url = reply->url().toEncoded().constData(); int idx = m_downloads.indexOf(reply); + if (idx < 0) { + qWarning("HttpDownloadManager::downloadFinished: reply not found in downloads"); + reply->deleteLater(); + return; + } QString filename = m_filenames[idx]; bool success = false; bool retry = false; From e724c841a0489e0527490a179c053a18af502a90 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 27 Oct 2026 23:57:32 -0400 Subject: [PATCH 30/34] sdrgui/dsp: Fix swapped scope screen dimensions Fix swapped arguments to getSize() to match the API's parameter order, ensuring rows and columns are assigned correctly. Identified by Coverity CID 652313. Signed-off-by: Robin Getz --- sdrgui/dsp/scopevisxy.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdrgui/dsp/scopevisxy.cpp b/sdrgui/dsp/scopevisxy.cpp index 55d0d6ba1..eacef6cf8 100644 --- a/sdrgui/dsp/scopevisxy.cpp +++ b/sdrgui/dsp/scopevisxy.cpp @@ -75,7 +75,7 @@ void ScopeVisXY::feed(const SampleVector::const_iterator& cbegin, const SampleVe if (m_pixelCount == m_pixelsPerFrame) { int rows, cols; - m_tvScreen->getSize(rows, cols); + m_tvScreen->getSize(cols, rows); if ((rows != m_rows) || (cols != m_cols)) { From 4a172e40332afd782373665d1d4fcddee246910e Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 27 Oct 2026 23:58:59 -0400 Subject: [PATCH 31/34] sdrgui/gui: Guard against missing channel in preset dialog Check that getChannel() returns a valid channel before accessing its URI or opening the presets dialog. Log a debug message and return if the channel is unavailable. Identified by Coverity CID 652402. Signed-off-by: Robin Getz --- sdrgui/gui/basicchannelsettingsdialog.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sdrgui/gui/basicchannelsettingsdialog.cpp b/sdrgui/gui/basicchannelsettingsdialog.cpp index b6660a0f7..ff73ff4ec 100644 --- a/sdrgui/gui/basicchannelsettingsdialog.cpp +++ b/sdrgui/gui/basicchannelsettingsdialog.cpp @@ -187,6 +187,11 @@ void BasicChannelSettingsDialog::on_presets_clicked() return; } ChannelAPI *channel = MainCore::instance()->getChannel(channelGUI->getDeviceSetIndex(), channelGUI->getIndex()); + if (!channel) + { + qDebug() << "BasicChannelSettingsDialog::on_presets_clicked: not a valid channel"; + return; + } const QString& id = channel->getURI(); PluginPresetsDialog dialog(id); From 145f018fcfeb6c7e195310149acb6adee2bbf048 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Wed, 28 Oct 2026 00:00:02 -0400 Subject: [PATCH 32/34] sdrgui/gui: Guard against missing website data in loadResource() Check that m_website is valid before accessing its files, preventing a null dereference when a resource is found but the website data is unavailable. Identified by Coverity CID 657903. Signed-off-by: Robin Getz --- sdrgui/gui/websitebrowser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdrgui/gui/websitebrowser.cpp b/sdrgui/gui/websitebrowser.cpp index 808b40f13..cada8dee9 100644 --- a/sdrgui/gui/websitebrowser.cpp +++ b/sdrgui/gui/websitebrowser.cpp @@ -391,7 +391,7 @@ QVariant WebsiteBrowser::loadResource(int type, const QUrl& name) m_used[url.toString(QUrl::RemoveFragment)] = use(*m_website, url); } - if (!found.empty()) + if (m_website && !found.empty()) { const auto file = m_website->files.find(found); From 30998df75cc4b3366ba98a0d4d2f852fe67b31eb Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Wed, 28 Oct 2026 00:02:46 -0400 Subject: [PATCH 33/34] mainwindow: Handle unavailable devices and channel GUIs Check default device indices before using them and verify channel GUI creation succeeds before accessing the result. Log warnings and return when resources are unavailable to prevent invalid accesses and improve runtime robustness. Coverity CIDs: 652207, 652226, 652248, and related findings. Signed-off-by: Robin Getz --- sdrgui/mainwindow.cpp | 90 ++++++++++++++++++++++++++++++++----------- 1 file changed, 68 insertions(+), 22 deletions(-) diff --git a/sdrgui/mainwindow.cpp b/sdrgui/mainwindow.cpp index 4bdec5bae..06c3e3c52 100644 --- a/sdrgui/mainwindow.cpp +++ b/sdrgui/mainwindow.cpp @@ -413,6 +413,10 @@ void AddSampleSourceFSM::addDevice() // Create a file source instance by default if requested device was not enumerated (index = -1) if (m_deviceIndex < 0) { m_deviceIndex = DeviceEnumerator::instance()->getFileInputDeviceIndex(); + if (m_deviceIndex < 0) { + qWarning("AddSampleSourceFSM::addDevice: File Input is not available"); + return; + } } m_mainWindow->sampleSourceCreate(m_deviceSetIndex, m_deviceIndex, m_deviceUISet); @@ -528,6 +532,10 @@ void AddSampleSinkFSM::addDevice() // Create a file sink instance by default if requested device was not enumerated (index = -1) if (m_deviceIndex < 0) { m_deviceIndex = DeviceEnumerator::instance()->getFileOutputDeviceIndex(); + if (m_deviceIndex < 0) { + qWarning("AddSampleSinkFSM::addDevice: File Output is not available"); + return; + } } m_mainWindow->sampleSinkCreate(m_deviceSetIndex, m_deviceIndex, m_deviceUISet); @@ -650,6 +658,10 @@ void AddSampleMIMOFSM::addDevice() // Create a Test MIMO instance by default if requested device was not enumerated (index = -1) if (m_deviceIndex < 0) { m_deviceIndex = DeviceEnumerator::instance()->getTestMIMODeviceIndex(); + if (m_deviceIndex < 0) { + qWarning("AddSampleMIMOFSM::addDevice: Test MIMO device is not available"); + return; + } } m_mainWindow->sampleMIMOCreate(m_deviceSetIndex, m_deviceIndex, m_deviceUISet); @@ -1340,6 +1352,10 @@ void MainWindow::sampleSourceCreate( { qDebug("MainWindow::sampleSourceCreate: non existent device replaced by File Input"); int fileInputDeviceIndex = DeviceEnumerator::instance()->getFileInputDeviceIndex(); + if (fileInputDeviceIndex < 0) { + qWarning("MainWindow::sampleSourceCreate: File Input is not available"); + return; + } deviceIndex = fileInputDeviceIndex; samplingDevice = DeviceEnumerator::instance()->getRxSamplingDevice(fileInputDeviceIndex); deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence); @@ -1498,6 +1514,10 @@ void MainWindow::sampleSinkCreate( { qDebug("MainWindow::sampleSinkCreate: non existent device replaced by File Sink"); int fileSinkDeviceIndex = DeviceEnumerator::instance()->getFileOutputDeviceIndex(); + if (fileSinkDeviceIndex < 0) { + qWarning("MainWindow::sampleSinkCreate: File Sink is not available"); + return; + } deviceIndex = fileSinkDeviceIndex; samplingDevice = DeviceEnumerator::instance()->getTxSamplingDevice(fileSinkDeviceIndex); deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence); @@ -1656,6 +1676,10 @@ void MainWindow::sampleMIMOCreate( { qDebug("MainWindow::sampleMIMOCreate: non existent device replaced by Test MIMO"); int testMIMODeviceIndex = DeviceEnumerator::instance()->getTestMIMODeviceIndex(); + if (testMIMODeviceIndex < 0) { + qWarning("MainWindow::sampleMIMOCreate: Test MIMO device is not available"); + return; + } deviceIndex = testMIMODeviceIndex; samplingDevice = DeviceEnumerator::instance()->getMIMOSamplingDevice(testMIMODeviceIndex); deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence); @@ -3885,6 +3909,11 @@ void MainWindow::channelAddClicked(Workspace *workspace, int deviceSetIndex, int BasebandSampleSink *rxChannel = nullptr; pluginInterface->createRxChannel(deviceUI->m_deviceAPI, &rxChannel, &channelAPI); gui = pluginInterface->createRxChannelGUI(deviceUI, rxChannel); + if (!gui) + { + qWarning("MainWindow::channelAddClicked: RxChannelGUI not available"); + return; + } deviceUI->registerRxChannelInstance(channelAPI, gui); gui->setDeviceType(ChannelGUI::DeviceType::DeviceRx); gui->setIndex(channelAPI->getIndexInDeviceSet()); @@ -3897,6 +3926,11 @@ void MainWindow::channelAddClicked(Workspace *workspace, int deviceSetIndex, int BasebandSampleSource *txChannel = nullptr; pluginInterface->createTxChannel(deviceUI->m_deviceAPI, &txChannel, &channelAPI); gui = pluginInterface->createTxChannelGUI(deviceUI, txChannel); + if (!gui) + { + qWarning("MainWindow::channelAddClicked: TxChannelGUI not available"); + return; + } deviceUI->registerTxChannelInstance(channelAPI, gui); gui->setDeviceType(ChannelGUI::DeviceType::DeviceTx); gui->setIndex(channelAPI->getIndexInDeviceSet()); @@ -3917,6 +3951,11 @@ void MainWindow::channelAddClicked(Workspace *workspace, int deviceSetIndex, int MIMOChannel *mimoChannel = nullptr; pluginInterface->createMIMOChannel(deviceUI->m_deviceAPI, &mimoChannel, &channelAPI); gui = pluginInterface->createMIMOChannelGUI(deviceUI, mimoChannel); + if (!gui) + { + qWarning("MainWindow::channelAddClicked: MIMOChannelGUI not available"); + return; + } deviceUI->registerChannelInstance(channelAPI, gui); gui->setIndex(channelAPI->getIndexInDeviceSet()); gui->setDisplayedame(pluginInterface->getPluginDescriptor().displayedName); @@ -3928,6 +3967,11 @@ void MainWindow::channelAddClicked(Workspace *workspace, int deviceSetIndex, int BasebandSampleSink *rxChannel = nullptr; pluginInterface->createRxChannel(deviceUI->m_deviceAPI, &rxChannel, &channelAPI); gui = pluginInterface->createRxChannelGUI(deviceUI, rxChannel); + if (!gui) + { + qWarning("MainWindow::channelAddClicked: RxChannelGUI not available"); + return; + } deviceUI->registerRxChannelInstance(channelAPI, gui); gui->setIndex(channelAPI->getIndexInDeviceSet()); gui->setDisplayedame(pluginInterface->getPluginDescriptor().displayedName); @@ -3939,6 +3983,11 @@ void MainWindow::channelAddClicked(Workspace *workspace, int deviceSetIndex, int BasebandSampleSource *txChannel = nullptr; pluginInterface->createTxChannel(deviceUI->m_deviceAPI, &txChannel, &channelAPI); gui = pluginInterface->createTxChannelGUI(deviceUI, txChannel); + if (!gui) + { + qWarning("MainWindow::channelAddClicked: TxChannelGUI not available"); + return; + } deviceUI->registerTxChannelInstance(channelAPI, gui); gui->setIndex(channelAPI->getIndexInDeviceSet()); gui->setDisplayedame(pluginInterface->getPluginDescriptor().displayedName); @@ -3955,35 +4004,32 @@ void MainWindow::channelAddClicked(Workspace *workspace, int deviceSetIndex, int return; } - if (gui) - { - QObject::connect( - gui, - &ChannelGUI::moveToWorkspace, - this, - [this, gui](int wsIndexDest){ this->channelMove(gui, wsIndexDest); } - ); - QObject::connect( - gui, - &ChannelGUI::duplicateChannelEmitted, - this, - [this, gui](){ this->channelDuplicate(gui); } - ); - QObject::connect( - gui, - &ChannelGUI::moveToDeviceSet, - this, - [this, gui](int dsIndexDest){ this->channelMoveToDeviceSet(gui, dsIndexDest); } - ); + QObject::connect( + gui, + &ChannelGUI::moveToWorkspace, + this, + [this, gui](int wsIndexDest){ this->channelMove(gui, wsIndexDest); } + ); + QObject::connect( + gui, + &ChannelGUI::duplicateChannelEmitted, + this, + [this, gui](){ this->channelDuplicate(gui); } + ); + QObject::connect( + gui, + &ChannelGUI::moveToDeviceSet, + this, + [this, gui](int dsIndexDest){ this->channelMoveToDeviceSet(gui, dsIndexDest); } + ); - gui->setDeviceSetIndex(deviceSetIndex); + gui->setDeviceSetIndex(deviceSetIndex); gui->setIndexToolTip(deviceAPI->getSamplingDeviceDisplayName()); gui->setWorkspaceIndex(workspace->getIndex()); qDebug("MainWindow::channelAddClicked: adding %s to workspace #%d", qPrintable(gui->getTitle()), workspace->getIndex()); workspace->addToMdiArea((QMdiSubWindow*) gui); loadDefaultPreset(channelAPI->getURI(), gui); - } } } From a10fb3a500c5dfdb71037b357589f95ea4320832 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Wed, 28 Oct 2026 00:06:15 -0400 Subject: [PATCH 34/34] mainserver: Handle unavailable default sampling devices Check default File Input, File Output, and Test MIMO device indices before using them when creating or changing devices. Log a warning and return if a device is unavailable, avoiding invalid indices and improving server runtime robustness. Coverity CIDs: 652143, 652186, 652269 and more. Signed-off-by: Robin Getz --- sdrsrv/mainserver.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/sdrsrv/mainserver.cpp b/sdrsrv/mainserver.cpp index ffebf660c..9037241e6 100644 --- a/sdrsrv/mainserver.cpp +++ b/sdrsrv/mainserver.cpp @@ -285,6 +285,10 @@ void MainServer::addSinkDevice() // create a file sink by default int fileSinkDeviceIndex = DeviceEnumerator::instance()->getFileOutputDeviceIndex(); + if (fileSinkDeviceIndex < 0) { + qWarning("MainServer::addSinkDevice: File Output is not available"); + return; + } const PluginInterface::SamplingDevice *samplingDevice = DeviceEnumerator::instance()->getTxSamplingDevice(fileSinkDeviceIndex); deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence); deviceAPI->setDeviceNbItems(samplingDevice->deviceNbItems); @@ -324,6 +328,10 @@ void MainServer::addSourceDevice() // Create a file source instance by default int fileSourceDeviceIndex = DeviceEnumerator::instance()->getFileInputDeviceIndex(); + if (fileSourceDeviceIndex < 0) { + qWarning("MainServer::addSourceDevice: File Input device is not available"); + return; + } const PluginInterface::SamplingDevice *samplingDevice = DeviceEnumerator::instance()->getRxSamplingDevice(fileSourceDeviceIndex); deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence); deviceAPI->setDeviceNbItems(samplingDevice->deviceNbItems); @@ -361,6 +369,10 @@ void MainServer::addMIMODevice() // create a test MIMO by default int testMIMODeviceIndex = DeviceEnumerator::instance()->getTestMIMODeviceIndex(); + if (testMIMODeviceIndex < 0) { + qWarning("MainServer::addMIMODevice: Test MIMO device is not available"); + return; + } const PluginInterface::SamplingDevice *samplingDevice = DeviceEnumerator::instance()->getMIMOSamplingDevice(testMIMODeviceIndex); deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence); deviceAPI->setDeviceNbItems(samplingDevice->deviceNbItems); @@ -463,6 +475,10 @@ void MainServer::changeSampleSource(int deviceSetIndex, int selectedDeviceIndex) { qDebug("MainServer::changeSampleSource: non existent device replaced by File Input"); int deviceIndex = DeviceEnumerator::instance()->getFileInputDeviceIndex(); + if (deviceIndex < 0) { + qWarning("MainServer::changeSampleSource: File Input is not available"); + return; + } samplingDevice = DeviceEnumerator::instance()->getRxSamplingDevice(deviceIndex); deviceSet->m_deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence); deviceSet->m_deviceAPI->setDeviceNbItems(samplingDevice->deviceNbItems); @@ -543,6 +559,10 @@ void MainServer::changeSampleSink(int deviceSetIndex, int selectedDeviceIndex) { qDebug("MainServer::changeSampleSink: non existent device replaced by File Sink"); int fileSinkDeviceIndex = DeviceEnumerator::instance()->getFileOutputDeviceIndex(); + if (fileSinkDeviceIndex < 0) { + qWarning("MainServer::changeSampleSink: File Sink is not available"); + return; + } samplingDevice = DeviceEnumerator::instance()->getTxSamplingDevice(fileSinkDeviceIndex); deviceSet->m_deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence); deviceSet->m_deviceAPI->setDeviceNbItems(samplingDevice->deviceNbItems); @@ -622,6 +642,10 @@ void MainServer::changeSampleMIMO(int deviceSetIndex, int selectedDeviceIndex) { qDebug("MainServer::changeSampleMIMO: non existent device replaced by Test MIMO"); int testMIMODeviceIndex = DeviceEnumerator::instance()->getTestMIMODeviceIndex(); + if (testMIMODeviceIndex < 0) { + qWarning("MainServer::changeSampleMIMO: Test MIMO device is not available"); + return; + } samplingDevice = DeviceEnumerator::instance()->getMIMOSamplingDevice(testMIMODeviceIndex); deviceSet->m_deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence); deviceSet->m_deviceAPI->setDeviceNbItems(samplingDevice->deviceNbItems);