From bbd62c366e7cbc19a5ebdb880de2370ce9b003bb Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 23:08:59 -0400 Subject: [PATCH 01/41] wsspectrum : Guard disconnected client logging Only log the disconnected client after confirming the socket pointer is valid. This avoids passing a null pointer to getWebSocketIdentifier() when socketDisconnected() is invoked without a valid client sender. Found by cppcheck. Signed-off-by: Robin Getz --- sdrbase/websockets/wsspectrum.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdrbase/websockets/wsspectrum.cpp b/sdrbase/websockets/wsspectrum.cpp index 401a7751d..ca69b99c7 100644 --- a/sdrbase/websockets/wsspectrum.cpp +++ b/sdrbase/websockets/wsspectrum.cpp @@ -126,10 +126,10 @@ void WSSpectrum::processClientMessage(const QString &message) void WSSpectrum::socketDisconnected() { QWebSocket *pClient = qobject_cast(sender()); - qDebug() << getWebSocketIdentifier(pClient) << " disconnected"; if (pClient) { + qDebug() << getWebSocketIdentifier(pClient) << " disconnected"; m_clients.removeAll(pClient); pClient->deleteLater(); } From 3f4a948595d435a71684034de2eeb99aeff6e4fc Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Wed, 16 Sep 2026 07:39:20 -0400 Subject: [PATCH 02/41] wsspectrum: Avoid overwriting existing WebSocket server Check for an existing QWebSocketServer before creating a new one. Leave an already-listening server untouched and clean up an existing non-listening server before replacing it. This resolves the cppcheck possible leak warning caused by overwriting m_webSocketServer without deallocating the previous object. Signed-off-by: Robin Getz --- sdrbase/websockets/wsspectrum.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sdrbase/websockets/wsspectrum.cpp b/sdrbase/websockets/wsspectrum.cpp index ca69b99c7..a92a4dae0 100644 --- a/sdrbase/websockets/wsspectrum.cpp +++ b/sdrbase/websockets/wsspectrum.cpp @@ -47,6 +47,17 @@ WSSpectrum::~WSSpectrum() void WSSpectrum::openSocket() { + if (m_webSocketServer) + { + if (m_webSocketServer->isListening()) + { + qDebug() << "WSSpectrum::openSocket: invoked while spectrum server already listening at " + << m_listeningAddress.toString() << " on port " << m_port; + return; + } + closeSocket(); + } + m_webSocketServer = new QWebSocketServer( QStringLiteral("Spectrum Server"), QWebSocketServer::NonSecureMode, From 282dd76efe0b06907debabb451b5f2480c1d248a Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 23:08:13 -0400 Subject: [PATCH 03/41] webapiadapterbase : Initialize plugin manager pointer Initialize the plugin manager pointer so a newly constructed adapter has a defined pointer value before it is accessed. Found by cppcheck (uninitMemberVar). Signed-off-by: Robin Getz --- sdrbase/webapi/webapiadapterbase.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdrbase/webapi/webapiadapterbase.cpp b/sdrbase/webapi/webapiadapterbase.cpp index da26089a2..14d66d740 100644 --- a/sdrbase/webapi/webapiadapterbase.cpp +++ b/sdrbase/webapi/webapiadapterbase.cpp @@ -27,7 +27,8 @@ #include "dsp/spectrumsettings.h" #include "webapiadapterbase.h" -WebAPIAdapterBase::WebAPIAdapterBase() +WebAPIAdapterBase::WebAPIAdapterBase() : + m_pluginManager(nullptr) {} WebAPIAdapterBase::~WebAPIAdapterBase() From 3cbe1e566257304bb7dd0adb8eef2e65a65e1c2d Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 23:58:14 -0400 Subject: [PATCH 04/41] weather : Initialize saved coordinates Initialize the saved latitude and longitude so Weather instances start with defined coordinates before periodic updates use them. Found by Coverity (UNINIT_CTOR). Signed-off-by: Robin Getz --- sdrbase/util/weather.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sdrbase/util/weather.cpp b/sdrbase/util/weather.cpp index 83337ca5b..66a3ec4a5 100644 --- a/sdrbase/util/weather.cpp +++ b/sdrbase/util/weather.cpp @@ -25,7 +25,9 @@ #include #include -Weather::Weather() +Weather::Weather() : + m_latitude(0.0f), + m_longitude(0.0f) { connect(&m_timer, &QTimer::timeout, this, &Weather::update); } From 95bfb863d7228a34630720c5d77949d6e818d163 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 22:59:30 -0400 Subject: [PATCH 05/41] wavfilerecord : Initialize sample shift Initialize the sample shift member so WAV recording starts with a defined shift value before it is used. This avoids undefined behavior from reading an uninitialized member. Found by cppcheck (uninitMemberVar). Signed-off-by: Robin Getz --- sdrbase/dsp/wavfilerecord.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/sdrbase/dsp/wavfilerecord.cpp b/sdrbase/dsp/wavfilerecord.cpp index 221dafff8..504921795 100644 --- a/sdrbase/dsp/wavfilerecord.cpp +++ b/sdrbase/dsp/wavfilerecord.cpp @@ -53,6 +53,7 @@ WavFileRecord::WavFileRecord(const QString& fileBase) : m_recordOn(false), m_recordStart(false), m_byteCount(0), + m_msShift(0), m_nbChannels(2) { setObjectName("WavFileRecord"); From 6e60343a942c2a80c8da9113279803210aa6e795 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 23:07:33 -0400 Subject: [PATCH 06/41] visa : Initialize VISA debug state Initialize the VISA debug I/O flag so the interface starts with a defined debug state before any VISA operations check or update it. Found by cppcheck (uninitMemberVar). Signed-off-by: Robin Getz --- sdrbase/util/visa.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sdrbase/util/visa.cpp b/sdrbase/util/visa.cpp index 49b09491f..8deca6976 100644 --- a/sdrbase/util/visa.cpp +++ b/sdrbase/util/visa.cpp @@ -35,8 +35,9 @@ VISA::VISA() : viScanf(nullptr), viFindRsrc(nullptr), viFindNext(nullptr), - visaLibrary(nullptr), - m_available(false) + m_available(false), + m_debugIO(false), + visaLibrary(nullptr) { #ifdef _MSC_VER const char *visaName = "visa32.dll"; // Loads visa64.dll on WIN64 From aa45e4f43546669939a531f4af682661947db2f1 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 22:58:51 -0400 Subject: [PATCH 07/41] spectrumsettings : Clarify nested ternary expressions Add parentheses around the nested ternary expressions used when clamping histogram and waterfall marker counts. This makes the intended evaluation order explicit and avoids ambiguity in static analysis of the conditional expressions. Found by cppcheck. Signed-off-by: Robin Getz --- sdrbase/dsp/spectrumsettings.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sdrbase/dsp/spectrumsettings.cpp b/sdrbase/dsp/spectrumsettings.cpp index 2f51e5872..607ea9276 100644 --- a/sdrbase/dsp/spectrumsettings.cpp +++ b/sdrbase/dsp/spectrumsettings.cpp @@ -320,8 +320,8 @@ bool SpectrumSettings::deserialize(const QByteArray& data) int histogramMarkersSize; d.readS32(100, &histogramMarkersSize, 0); histogramMarkersSize = histogramMarkersSize < 0 ? 0 : - histogramMarkersSize > SpectrumHistogramMarker::m_maxNbOfMarkers ? - SpectrumHistogramMarker::m_maxNbOfMarkers : histogramMarkersSize; + (histogramMarkersSize > SpectrumHistogramMarker::m_maxNbOfMarkers ? + SpectrumHistogramMarker::m_maxNbOfMarkers : histogramMarkersSize); m_histogramMarkers.clear(); for (int i = 0; i < histogramMarkersSize; i++) @@ -335,8 +335,8 @@ bool SpectrumSettings::deserialize(const QByteArray& data) d.readS32(110, &waterfallMarkersSize, 0); waterfallMarkersSize = waterfallMarkersSize < 0 ? 0 : - waterfallMarkersSize > SpectrumWaterfallMarker::m_maxNbOfMarkers ? - SpectrumWaterfallMarker::m_maxNbOfMarkers : waterfallMarkersSize; + (waterfallMarkersSize > SpectrumWaterfallMarker::m_maxNbOfMarkers ? + SpectrumWaterfallMarker::m_maxNbOfMarkers : waterfallMarkersSize); m_waterfallMarkers.clear(); for (int i = 0; i < waterfallMarkersSize; i++) From f60e6fb72b1bd73a8e732c9642c4a907602512db Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 23:55:36 -0400 Subject: [PATCH 08/41] simpleserializer : Initialize deserializer version Initialize the deserializer version so invalid or incomplete data leaves the version field with a defined value. Found by Coverity (UNINIT_CTOR). Signed-off-by: Robin Getz --- sdrbase/util/simpleserializer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdrbase/util/simpleserializer.cpp b/sdrbase/util/simpleserializer.cpp index 0ced52faa..5734a1a07 100644 --- a/sdrbase/util/simpleserializer.cpp +++ b/sdrbase/util/simpleserializer.cpp @@ -313,7 +313,8 @@ bool SimpleSerializer::writeTag(Type type, quint32 id, quint32 length) } SimpleDeserializer::SimpleDeserializer(const QByteArray& data) : - m_data(data) + m_data(data), + m_version(0) { m_valid = parseAll(); From 345a47ceb65be6240992e17c71928238d38c3db4 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 22:57:55 -0400 Subject: [PATCH 09/41] scopevis : Initialize conversion buffer size Initialize the conversion buffer size so a default-constructed ConvertBuffers instance has a defined size before the value is used. This avoids undefined behavior from reading an uninitialized member. Found by cppcheck (uninitMemberVar). Signed-off-by: Robin Getz --- sdrbase/dsp/scopevis.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sdrbase/dsp/scopevis.h b/sdrbase/dsp/scopevis.h index da1023c78..2b487f6d3 100644 --- a/sdrbase/dsp/scopevis.h +++ b/sdrbase/dsp/scopevis.h @@ -601,6 +601,7 @@ private: struct ConvertBuffers { ConvertBuffers(uint32_t nbStreams = 1) : + m_size(0), m_convertBuffers(nbStreams) {} From 0f7794d38be84f99d4e5868504ee69e72034827e Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 22:57:18 -0400 Subject: [PATCH 10/41] samplesourcefifo : Initialize FIFO state Initialize the FIFO sizing, guard, midpoint, and read/write tracking members so the default constructor leaves the object in a defined state. This ensures FIFO state is valid even if the object is accessed before explicit configuration. Found by cppcheck (uninitMemberVar). Signed-off-by: Robin Getz --- sdrbase/dsp/samplesourcefifo.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sdrbase/dsp/samplesourcefifo.cpp b/sdrbase/dsp/samplesourcefifo.cpp index 8ae0b1945..a1ee7830f 100644 --- a/sdrbase/dsp/samplesourcefifo.cpp +++ b/sdrbase/dsp/samplesourcefifo.cpp @@ -24,7 +24,14 @@ const unsigned int SampleSourceFifo::m_rwDivisor = 2; const unsigned int SampleSourceFifo::m_guardDivisor = 10; SampleSourceFifo::SampleSourceFifo(QObject *parent) : - QObject(parent) + QObject(parent), + m_size(0), + m_lowGuard(0), + m_highGuard(0), + m_midPoint(0), + m_readHead(0), + m_writeHead(0), + m_readCount(0) {} SampleSourceFifo::SampleSourceFifo(unsigned int size, QObject *parent) : From b79b50c24c52c7218e237888f56cb1bfc163085f Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 22:56:41 -0400 Subject: [PATCH 11/41] samplemofifo : Initialize FIFO state Initialize the FIFO sizing, guard, position, and read/write tracking members so the default constructor establishes a complete and predictable state. This avoids undefined behavior if the FIFO is accessed before being fully configured. Found by cppcheck (uninitMemberVar). Signed-off-by: Robin Getz --- sdrbase/dsp/samplemofifo.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sdrbase/dsp/samplemofifo.cpp b/sdrbase/dsp/samplemofifo.cpp index aa9a0ba2d..85539a56a 100644 --- a/sdrbase/dsp/samplemofifo.cpp +++ b/sdrbase/dsp/samplemofifo.cpp @@ -24,7 +24,14 @@ const unsigned int SampleMOFifo::m_guardDivisor = 10; SampleMOFifo::SampleMOFifo(QObject *parent) : QObject(parent), - m_nbStreams(0) + m_nbStreams(0), + m_size(0), + m_lowGuard(0), + m_highGuard(0), + m_midPoint(0), + m_readCount(0), + m_readHead(0), + m_writeHead(0) {} SampleMOFifo::SampleMOFifo(unsigned int nbStreams, unsigned int size, QObject *parent) : From 741195978f3efc7b83389e53cf3c7a9a460079d4 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 22:55:30 -0400 Subject: [PATCH 12/41] replaybuffer : Initialize loop state Initialize the replay loop flag so a newly created buffer has a defined playback mode before the buffer is used. This avoids undefined behavior from evaluating an uninitialized member. Found by cppcheck (uninitMemberVar). Signed-off-by: Robin Getz --- sdrbase/dsp/replaybuffer.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sdrbase/dsp/replaybuffer.h b/sdrbase/dsp/replaybuffer.h index 9e52ab0c1..dae72d75d 100644 --- a/sdrbase/dsp/replaybuffer.h +++ b/sdrbase/dsp/replaybuffer.h @@ -33,12 +33,13 @@ template class ReplayBuffer { public: - ReplayBuffer() : + ReplayBuffer() : m_data(1000000*2, 0), m_write(0), m_read(0), m_readOffset(0), - m_count(0) + m_count(0), + m_loop(false) { } From 0b2a610433877281e803f8db21ca22e7803a975b Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 23:00:06 -0400 Subject: [PATCH 13/41] remotetcpsinkstarter : Mark unused serial parameter Explicitly mark the serial parameter as unused to avoid a compiler warning while retaining the parameter in the constructor interface. Found by cppcheck. Signed-off-by: Robin Getz --- sdrbase/remotetcpsinkstarter.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sdrbase/remotetcpsinkstarter.cpp b/sdrbase/remotetcpsinkstarter.cpp index 71d3c0e8c..acafecab1 100644 --- a/sdrbase/remotetcpsinkstarter.cpp +++ b/sdrbase/remotetcpsinkstarter.cpp @@ -60,6 +60,8 @@ RemoteTCPSinkStarter::RemoteTCPSinkStarter(const QString& address, int port, con m_dataPort(port), m_deviceSet(nullptr) { + Q_UNUSED(serial); + // Add device of requested type SWGSDRangel::SWGDeviceSettings *response = new SWGSDRangel::SWGDeviceSettings(); response->init(); From 9ff6600c732461e5abf12085bc827675f851dc09 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 23:06:48 -0400 Subject: [PATCH 14/41] radiosonde : Initialize RS41 sensor values & frame navigation state Initialize the RS41 pressure, temperature, and humidity measurements so decoded frames have defined sensor values before calibration or other processing uses them. Initialize the RS41 frame number and navigation fields so frames without corresponding status or GPS data leave these values defined. Found by Coverity (UNINIT_CTOR). Signed-off-by: Robin Getz --- sdrbase/util/radiosonde.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sdrbase/util/radiosonde.cpp b/sdrbase/util/radiosonde.cpp index b9f37cfb9..4cc3603c7 100644 --- a/sdrbase/util/radiosonde.cpp +++ b/sdrbase/util/radiosonde.cpp @@ -25,6 +25,7 @@ RS41Frame::RS41Frame(const QByteArray ba) : m_statusValid(false), + m_frameNumber(0), m_batteryVoltage(0.0), m_pcbTemperature(0), m_humiditySensorHeating(0), @@ -37,10 +38,18 @@ RS41Frame::RS41Frame(const QByteArray ba) : m_latitude(0.0), m_longitude(0.0), m_height(0.0), + m_speed(0.0), + m_heading(0.0), + m_verticalRate(0.0), + m_satellitesUsed(0), m_bytes(ba), + m_pressure(0.0), m_pressureCalibrated(false), + m_temperature(0.0), m_temperatureCalibrated(false), + m_humidityTemperature(0.0), m_humidityTemperatureCalibrated(false), + m_humidity(0.0), m_humidityCalibrated(false) { int length = getFrameLength(ba[RS41_OFFSET_FRAME_TYPE]); From f7fc03553f2001025cf5b9450652b71e8aa16e2e Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 22:54:54 -0400 Subject: [PATCH 15/41] projector : Initialize previous value Initialize the previous projected value so the first calculation has a defined starting state rather than depending on whatever value happens to be in the member. Found by cppcheck (uninitMemberVar). Signed-off-by: Robin Getz --- sdrbase/dsp/projector.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/sdrbase/dsp/projector.cpp b/sdrbase/dsp/projector.cpp index 135d8b6e8..8c99d0b67 100644 --- a/sdrbase/dsp/projector.cpp +++ b/sdrbase/dsp/projector.cpp @@ -22,6 +22,7 @@ Projector::Projector(ProjectionType projectionType) : m_projectionType(projectionType), m_prevArg(0.0f), + m_prevVal(0.0f), m_cache(nullptr), m_cacheMaster(true) { From 4ae02698a95c10f0b4bf64c981c6cb81a54a0dc1 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 23:00:44 -0400 Subject: [PATCH 16/41] preset : Initialize selected device indices Initialize the selected device sequence and item index so default-constructed device selections contain defined index values before they are used. This avoids undefined behavior from accessing uninitialized members. Found by cppcheck (uninitMemberVar). Signed-off-by: Robin Getz --- sdrbase/settings/preset.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sdrbase/settings/preset.h b/sdrbase/settings/preset.h index 4cd906b8b..dfc1cc82d 100644 --- a/sdrbase/settings/preset.h +++ b/sdrbase/settings/preset.h @@ -61,10 +61,10 @@ public: struct SelectedDevice { - QString m_deviceId; - QString m_deviceSerial; - int m_deviceSequence; - int m_deviceItemIndex; + QString m_deviceId; + QString m_deviceSerial; + int m_deviceSequence = 0; + int m_deviceItemIndex = 0; SelectedDevice() = default; SelectedDevice(const SelectedDevice&) = default; From 2bbabb4daf17555708b607e2a22ca3badbf30885 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Tue, 15 Sep 2026 00:25:34 -0400 Subject: [PATCH 17/41] popcount : Increase portability of fallback popcount implementation The previous implementation shifted a signed 32-bit value by up to 31 bits, which is implementation-defined behavior. It also had a fixed 32-bit limit and different semantics from the compiler built-ins. Use unsigned integer semantics and Brian Kernighan's method for the portable popcount implementation. This avoids implementation-defined signed right shifts and counts all bits in the unsigned integer type, matching the semantics of the compiler built-ins and C++20 std::popcount, and should have a minor speed improvement for random samples. Found by cppcheck (shiftTooManyBitsSigned) Signed-off-by: Robin Getz --- sdrbase/util/popcount.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sdrbase/util/popcount.h b/sdrbase/util/popcount.h index 974a5b0b1..79cc62838 100644 --- a/sdrbase/util/popcount.h +++ b/sdrbase/util/popcount.h @@ -31,11 +31,17 @@ #include #define popcount __popcnt #else -static int popcount(int in) +// https://en.cppreference.com/cpp/numeric/popcount +// std::popcount requires an unsigned integer type. +// +// Brian Kernighan's method: +// https://graphics.stanford.edu/~seander/bithacks.html +static int popcount(unsigned int in) { - int cnt = 0; - for(int i = 0; i < 32; i++) - cnt += (in >> i) & 1; + for (int cnt = 0; in; cnt++) + { + in &= in - 1; // clear the least significant bit set + } return cnt; } #endif From fb5523f54344c68604f0c9a8aeb1dde51f9ae0ea Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 23:06:15 -0400 Subject: [PATCH 18/41] png : Initialize image dimensions Initialize the PNG image dimensions so a newly constructed instance starts with defined width and height values before they are accessed. Found by cppcheck (uninitMemberVar). Signed-off-by: Robin Getz --- sdrbase/util/png.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sdrbase/util/png.cpp b/sdrbase/util/png.cpp index f9aaadd93..8617e684e 100644 --- a/sdrbase/util/png.cpp +++ b/sdrbase/util/png.cpp @@ -22,7 +22,9 @@ #include #include -PNG::PNG() +PNG::PNG() : + m_width(0), + m_height(0) { } From 70b180214817a2cb76ac113f560f58b097d50bda Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 23:46:27 -0400 Subject: [PATCH 19/41] openaip : Initialize country index Initialize the country index so a newly constructed OpenAIP instance starts with a defined value. Found by Coverity (UNINIT_CTOR). Signed-off-by: Robin Getz --- sdrbase/util/openaip.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdrbase/util/openaip.cpp b/sdrbase/util/openaip.cpp index 197411c62..6bba524ae 100644 --- a/sdrbase/util/openaip.cpp +++ b/sdrbase/util/openaip.cpp @@ -520,7 +520,8 @@ QDateTime OpenAIP::m_airspacesModifiedDateTime; QDateTime OpenAIP::m_navAidsModifiedDateTime; OpenAIP::OpenAIP(QObject *parent) : - QObject(parent) + QObject(parent), + m_countryIndex(0) { connect(&m_dlm, &HttpDownloadManager::downloadComplete, this, &OpenAIP::downloadFinished); } From 6004191d1105bce722c5536cca7ce985a1cb1b1a Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 22:54:12 -0400 Subject: [PATCH 20/41] nco : Initialize oscillator state Initialize the NCO phase, increment, LFSR, and dithering state so the oscillator begins from defined values before generating samples. This avoids undefined behavior from reading uninitialized member variables. Found by cppcheck (uninitMemberVar). Signed-off-by: Robin Getz --- sdrbase/dsp/nco.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sdrbase/dsp/nco.cpp b/sdrbase/dsp/nco.cpp index d148b7f17..cab6dee5c 100644 --- a/sdrbase/dsp/nco.cpp +++ b/sdrbase/dsp/nco.cpp @@ -38,7 +38,12 @@ void NCO::initTable() m_tableInitialized = true; } -NCO::NCO() +NCO::NCO() : + m_phaseIncrement(0), + m_phase(0), + m_phaseDithered(0), + m_lfsr(0), + m_ditherMask(0) { initTable(); m_phase = 0; From cc632ec02bbf0d6e94223db69b2f67fc6af9f645 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 23:05:38 -0400 Subject: [PATCH 21/41] movingaverage : Initialize sample buffer Initialize the moving average sample buffer so a newly constructed instance has defined storage before samples are accumulated or accessed. Found by cppcheck (uninitMemberVar). Signed-off-by: Robin Getz --- sdrbase/util/movingaverage.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sdrbase/util/movingaverage.h b/sdrbase/util/movingaverage.h index c1849b3eb..99ec47f27 100644 --- a/sdrbase/util/movingaverage.h +++ b/sdrbase/util/movingaverage.h @@ -29,8 +29,11 @@ template class MovingAverageUtil { public: - MovingAverageUtil() - : m_num_samples(0), m_index(0), m_total(0) + MovingAverageUtil() : + m_samples{}, + m_num_samples(0), + m_index(0), + m_total(0) { } void reset() From 50caef61f83132580cdf3c8b58d2a9926d6f644f Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 22:52:58 -0400 Subject: [PATCH 22/41] morsedemod : Initialize MorseDemod members Initialize MorseDemod state and message queue members so a newly constructed demodulator has defined values before identification and bit timing processing begins. This prevents undefined behavior from accessing uninitialized member variables. Found by cppcheck (uninitMemberVar). Signed-off-by: Robin Getz --- sdrbase/dsp/morsedemod.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sdrbase/dsp/morsedemod.cpp b/sdrbase/dsp/morsedemod.cpp index 014220ead..29bd28a01 100644 --- a/sdrbase/dsp/morsedemod.cpp +++ b/sdrbase/dsp/morsedemod.cpp @@ -24,9 +24,17 @@ MESSAGE_CLASS_DEFINITION(MorseDemod::MsgReportIdent, Message) MorseDemod::MorseDemod() : + m_messageQueueToChannel(nullptr), m_movingAverageIdent(5000), + m_identMaxs{}, + m_identNoise(0.0), + m_binSampleCnt(0), + m_binCnt(0), + m_samplesPerDot7wpm(0), + m_samplesPerDot10wpm(0), m_prevBit(0), - m_bitTime(0) + m_bitTime(0), + m_identThreshold(0) { } From bd60409c750d007679ae18fdab588abf3e08da2f Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 23:04:54 -0400 Subject: [PATCH 23/41] kiwisdrlist : Initialize parsed SDR state and report unknown fields Initialize KiwiSDR parsing state and log previously unhandled keys once per process. This gives newly parsed records defined member values while making unexpected fields in the KiwiSDR data visible without repeatedly flooding the debug log. Found by cppcheck (uninitMemberVar) and Coverity Signed-off-by: Robin Getz --- sdrbase/util/kiwisdrlist.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sdrbase/util/kiwisdrlist.cpp b/sdrbase/util/kiwisdrlist.cpp index 115ba1fdb..6e4aa93ae 100644 --- a/sdrbase/util/kiwisdrlist.cpp +++ b/sdrbase/util/kiwisdrlist.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include "util/corsproxy.h" @@ -100,6 +101,7 @@ void KiwiSDRList::handleReply(QNetworkReply* reply) void KiwiSDRList::handleHTML(const QString& url, const QByteArray& bytes) { + static QSet unhandledKeys{}; (void) url; QList sdrs; @@ -123,7 +125,7 @@ void KiwiSDRList::handleHTML(const QString& url, const QByteArray& bytes) if (urlMatch.hasMatch()) { - KiwiSDR sdr; + KiwiSDR sdr{}; sdr.m_url = urlMatch.captured(1); @@ -193,6 +195,11 @@ void KiwiSDRList::handleHTML(const QString& url, const QByteArray& bytes) { sdr.m_snr = value; } + else if (!unhandledKeys.contains(key)) + { + qDebug() << "KiwiSDRList::handleHTML: Unhandled key:" << key << "value:" << value; + unhandledKeys.insert(key); + } } sdrs.append(sdr); From 682b06a67d52a395deeec3b5dcb0afc87cbfec33 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 22:52:09 -0400 Subject: [PATCH 24/41] kissfft : Initialize kissfft members Initialize the default kissfft constructor members so a default-constructed instance has a defined FFT size and direction before they are accessed. This prevents undefined behavior from using uninitialized member variables. Found by cppcheck (uninitMemberVar). Signed-off-by: Robin Getz --- sdrbase/dsp/kissfft.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sdrbase/dsp/kissfft.h b/sdrbase/dsp/kissfft.h index ff0975d90..5dcb3c2e3 100644 --- a/sdrbase/dsp/kissfft.h +++ b/sdrbase/dsp/kissfft.h @@ -114,9 +114,11 @@ public: typedef typename traits_type::scalar_type scalar_type; typedef typename traits_type::cpx_type cpx_type; - kissfft() - { - } + kissfft() : + _nfft(0), + _inverse(false) + { + } kissfft(int nfft, bool inverse, const traits_type & traits = traits_type()) : _nfft(nfft), _inverse(inverse), _traits(traits) From 6667c7f1b027fd3bbdcd395235456d7803d5b3e6 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 23:02:38 -0400 Subject: [PATCH 25/41] golay2312 : Initialize correction tables Initialize the Golay correction tables so the decoder starts with defined table contents before they are populated and used. This avoids undefined behavior from accessing uninitialized member storage. Found by cppcheck (uninitMemberVar). Signed-off-by: Robin Getz --- sdrbase/util/golay2312.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sdrbase/util/golay2312.cpp b/sdrbase/util/golay2312.cpp index 0ad1cf7bc..9a2be0e0b 100644 --- a/sdrbase/util/golay2312.cpp +++ b/sdrbase/util/golay2312.cpp @@ -63,7 +63,9 @@ const unsigned int Golay2312::m_I12[12] = { 0b000000000001, }; -Golay2312::Golay2312() +Golay2312::Golay2312() : + m_corrPL{}, + m_corrPF{} { initG(); initH(); From 152464479c3d22704634822d26cf5ebeab887564 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 23:43:37 -0400 Subject: [PATCH 26/41] fits : Initialize FITS parsing state Initialize FITS scalar members so partially parsed or invalid resources leave the object with defined dimensions, scaling, coordinate, and data offset values. Found by Coverity (UNINIT_CTOR). Signed-off-by: Robin Getz --- sdrbase/util/fits.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sdrbase/util/fits.cpp b/sdrbase/util/fits.cpp index f91cddf30..b711ca709 100644 --- a/sdrbase/util/fits.cpp +++ b/sdrbase/util/fits.cpp @@ -27,7 +27,17 @@ #include "fits.h" FITS::FITS(QString resourceName) : - m_valid(false) + m_valid(false), + m_width(0), + m_height(0), + m_bitsPerPixel(0), + m_bytesPerPixel(0), + m_bzero(0), + m_bscale(0.0), + m_uintScale(0.0f), + m_cdelta1(0.0), + m_cdelta2(0.0), + m_dataStart(0) { QResource m_res(resourceName); if (!m_res.isValid()) { From 5e9e972b2782d7a2dd07a078b126e2021cdf2244 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 23:26:43 -0400 Subject: [PATCH 27/41] filerecordinterface : Initialize GUI message queue Initialize the GUI message queue pointer so FileRecordInterface starts with a defined value before the GUI queue is assigned. Found by Coverity (UNINIT_CTOR). Signed-off-by: Robin Getz --- sdrbase/dsp/filerecordinterface.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdrbase/dsp/filerecordinterface.cpp b/sdrbase/dsp/filerecordinterface.cpp index 4b6c95964..3172f362e 100644 --- a/sdrbase/dsp/filerecordinterface.cpp +++ b/sdrbase/dsp/filerecordinterface.cpp @@ -25,7 +25,8 @@ #include "filerecordinterface.h" -FileRecordInterface::FileRecordInterface() +FileRecordInterface::FileRecordInterface() : + m_guiMessageQueue(nullptr) { connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages())); } From 05370d5db714a3a581fd108813d53c35c9670e65 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 22:51:15 -0400 Subject: [PATCH 28/41] filerecord : Initialize FileRecord sample shift Initialize the sample shift member so file recording starts with a defined shift value before it is used. This prevents undefined behavior from accessing an uninitialized member. Found by cppcheck (uninitMemberVar). Signed-off-by: Robin Getz --- sdrbase/dsp/filerecord.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdrbase/dsp/filerecord.cpp b/sdrbase/dsp/filerecord.cpp index e60b054ea..e772a1c7c 100644 --- a/sdrbase/dsp/filerecord.cpp +++ b/sdrbase/dsp/filerecord.cpp @@ -53,7 +53,8 @@ FileRecord::FileRecord(const QString& fileBase) : m_centerFrequency(0), m_recordOn(false), m_recordStart(false), - m_byteCount(0) + m_byteCount(0), + m_msShift(0) { setObjectName("FileRecord"); } From 52de1ed8b298b32c1f7263876af29a87d7f6cbfc Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 23:29:30 -0400 Subject: [PATCH 29/41] feature : Initialize feature state and indices Initialize the feature state and workspace and feature-set indices so a newly constructed Feature has defined values before its state or indices are queried. Found by Coverity (UNINIT_CTOR). Signed-off-by: Robin Getz --- sdrbase/feature/feature.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sdrbase/feature/feature.cpp b/sdrbase/feature/feature.cpp index 3b3bd40a8..88ad2c216 100644 --- a/sdrbase/feature/feature.cpp +++ b/sdrbase/feature/feature.cpp @@ -29,10 +29,13 @@ Feature::Feature(const QString& uri, WebAPIAdapterInterface *webAPIAdapterInterface) : m_guiMessageQueue(nullptr), - m_webAPIAdapterInterface(webAPIAdapterInterface), + m_state(StNotStarted), + m_webAPIAdapterInterface(webAPIAdapterInterface), m_name(uri), - m_uri(uri), - m_uid(UidCalculator::getNewObjectId()) + m_uri(uri), + m_uid(UidCalculator::getNewObjectId()), + m_indexInFeatureSet(0), + m_workspaceIndex(0) { connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages())); } From 95875e2f5caa0a17bf44972de89ed488364f438b Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 22:50:25 -0400 Subject: [PATCH 30/41] dsp/fftnr : Initialize FFT noise reduction state Initialize FFTNoiseReduction magnitude state and ExponentialFilter previous value so noise reduction calculations start from defined values. This prevents undefined behavior from using uninitialized state during filtering. Found by cppcheck (uninitMemberVar). Signed-off-by: Robin Getz --- sdrbase/dsp/fftnr.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sdrbase/dsp/fftnr.cpp b/sdrbase/dsp/fftnr.cpp index 56328f660..2237a5c94 100644 --- a/sdrbase/dsp/fftnr.cpp +++ b/sdrbase/dsp/fftnr.cpp @@ -25,7 +25,9 @@ #include "fftnr.h" FFTNoiseReduction::FFTNoiseReduction(int len) : - m_flen(len) + m_flen(len), + m_magAvg(0.0f), + m_magThr(0.0f) { m_scheme = SchemeAverage; m_mags = new float[m_flen]; @@ -107,7 +109,8 @@ void FFTNoiseReduction::setScheme(Scheme scheme) m_scheme = scheme; } -FFTNoiseReduction::ExponentialFilter::ExponentialFilter() +FFTNoiseReduction::ExponentialFilter::ExponentialFilter() : + m_prev(0.0f) { m_alpha = 1.0; m_init = true; From a9eead8a2ff37ef6c4c84d698cc3b3b74355b4bf Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 22:49:30 -0400 Subject: [PATCH 31/41] dsp/fftfilt : Initialize fftfilt noise reduction members Initialize the noise reduction configuration members in all fftfilt constructors so they have defined values before noise reduction processing uses them. This prevents undefined behavior and ensures consistent default configuration regardless of which constructor is used. Found by cppcheck (uninitMemberVar). Signed-off-by: Robin Getz --- sdrbase/dsp/fftfilt.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sdrbase/dsp/fftfilt.cpp b/sdrbase/dsp/fftfilt.cpp index aa8123c76..39f238fe4 100644 --- a/sdrbase/dsp/fftfilt.cpp +++ b/sdrbase/dsp/fftfilt.cpp @@ -99,6 +99,10 @@ void fftfilt::init_filter() // f2 == 0 ==> high pass filter //------------------------------------------------------------------------------ fftfilt::fftfilt(int len) : + m_dnrScheme(FFTNoiseReduction::SchemeAverage), + m_dnrAboveAvgFactor(0.0f), + m_dnrSigmaFactor(0.0f), + m_dnrNbPeaks(0), m_noiseReduction(len) { flen = len; @@ -109,6 +113,10 @@ fftfilt::fftfilt(int len) : } fftfilt::fftfilt(float f1, float f2, int len) : + m_dnrScheme(FFTNoiseReduction::SchemeAverage), + m_dnrAboveAvgFactor(0.0f), + m_dnrSigmaFactor(0.0f), + m_dnrNbPeaks(0), m_noiseReduction(len) { flen = len; @@ -120,6 +128,10 @@ fftfilt::fftfilt(float f1, float f2, int len) : } fftfilt::fftfilt(float f2, int len) : + m_dnrScheme(FFTNoiseReduction::SchemeAverage), + m_dnrAboveAvgFactor(0.0f), + m_dnrSigmaFactor(0.0f), + m_dnrNbPeaks(0), m_noiseReduction(len) { flen = len; From f86b691a7a101102756980959d0bca8cf0cc5a98 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 23:21:38 -0400 Subject: [PATCH 32/41] deviceset : Initialize spectrum visualizer pointer Initialize the spectrum visualizer pointer before the device type determines whether a SpectrumVis instance is created. This ensures unsupported or unexpected device types leave the member in a defined state. Found by Coverity (UNINIT_CTOR). Signed-off-by: Robin Getz --- sdrbase/device/deviceset.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdrbase/device/deviceset.cpp b/sdrbase/device/deviceset.cpp index 731188277..134fb64e3 100644 --- a/sdrbase/device/deviceset.cpp +++ b/sdrbase/device/deviceset.cpp @@ -33,7 +33,8 @@ #include "deviceset.h" -DeviceSet::DeviceSet(int tabIndex, int deviceType) +DeviceSet::DeviceSet(int tabIndex, int deviceType) : + m_spectrumVis(nullptr) { m_deviceAPI = nullptr; m_deviceSourceEngine = nullptr; From 792ec7e2f69fc07e90abcf1f152a4e75d28f18cb Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 23:23:40 -0400 Subject: [PATCH 33/41] devicesamplemimo : Initialize MIMO type Initialize the MIMO type so DeviceSampleMIMO starts with a defined mode before a derived device configures its specific synchronization behavior. Found by Coverity (UNINIT_CTOR). Signed-off-by: Robin Getz --- sdrbase/dsp/devicesamplemimo.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/sdrbase/dsp/devicesamplemimo.cpp b/sdrbase/dsp/devicesamplemimo.cpp index c3de8162b..efc789038 100644 --- a/sdrbase/dsp/devicesamplemimo.cpp +++ b/sdrbase/dsp/devicesamplemimo.cpp @@ -20,6 +20,7 @@ #include "devicesamplemimo.h" DeviceSampleMIMO::DeviceSampleMIMO() : + m_mimoType(MIMOAsynchronous), m_guiMessageQueue(nullptr) { connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages())); From bff78e084a89f1f8e9265101aeeb1b0c6b020f35 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 23:37:34 -0400 Subject: [PATCH 34/41] crc : Initialize reversed polynomial Initialize the reversed polynomial so crc instances have a defined value before the non-MSB-first configuration calculates it. Found by Coverity (UNINIT_CTOR). Signed-off-by: Robin Getz --- sdrbase/util/crc.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sdrbase/util/crc.h b/sdrbase/util/crc.h index 472298b9c..8d15ba23f 100644 --- a/sdrbase/util/crc.h +++ b/sdrbase/util/crc.h @@ -30,6 +30,7 @@ public: // Create and initialise CRC with specified polynomial and parameters crc(int poly_bits, uint32_t polynomial, bool msb_first, uint32_t init_value, uint32_t final_xor) : m_polynomial(polynomial), + m_polynomial_rev(0), m_poly_bits(poly_bits), m_msb_first(msb_first), m_init_value(init_value), From 882256e96689957122fe00ea93d3d7d323d08b48 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 22:48:30 -0400 Subject: [PATCH 35/41] availablechannelorfeature : Initialize members Initialize the indices and object pointer with safe default values so default-constructed AvailableChannelOrFeature instances have defined state before their members are accessed. This prevents undefined behavior from using uninitialized data. Found by cppcheck (uninitMemberVar). Signed-off-by: Robin Getz --- sdrbase/availablechannelorfeature.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sdrbase/availablechannelorfeature.h b/sdrbase/availablechannelorfeature.h index a3b9f3dab..077bdbd47 100644 --- a/sdrbase/availablechannelorfeature.h +++ b/sdrbase/availablechannelorfeature.h @@ -27,11 +27,11 @@ struct SDRBASE_API AvailableChannelOrFeature { QChar m_kind; //!< 'R' or 'T' for channel, 'M' for MIMO channel, 'F' for feature as from MainCore::getDeviceSetTypeId - int m_superIndex; //!< Device Set index or Feature Set index - int m_index; //!< Channel or Feature index - int m_streamIndex; //!< For MIMO channels only + int m_superIndex = 0; //!< Device Set index or Feature Set index + int m_index = 0; //!< Channel or Feature index + int m_streamIndex = 0; //!< For MIMO channels only QString m_type; //!< Plugin type (E.g. NFMDemod) - QObject *m_object; //!< Pointer to the object (ChannelAPI or Feature object) + QObject *m_object = nullptr; //!< Pointer to the object (ChannelAPI or Feature object) AvailableChannelOrFeature() = default; AvailableChannelOrFeature(const AvailableChannelOrFeature&) = default; From 65f3bf79a7700755c596a63ba2a0945dfb8b2f35 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 23:18:48 -0400 Subject: [PATCH 36/41] AudioInputDevice : Initialize manager message queue pointer Initialize the manager message queue pointer so AudioInputDevice instances do not retain an indeterminate pointer before a manager queue is assigned. Found by Coverity (UNINIT_CTOR). Signed-off-by: Robin Getz --- sdrbase/audio/audioinputdevice.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sdrbase/audio/audioinputdevice.cpp b/sdrbase/audio/audioinputdevice.cpp index 955c644c0..12100341d 100644 --- a/sdrbase/audio/audioinputdevice.cpp +++ b/sdrbase/audio/audioinputdevice.cpp @@ -35,11 +35,12 @@ MESSAGE_CLASS_DEFINITION(AudioInputDevice::MsgStop, Message) MESSAGE_CLASS_DEFINITION(AudioInputDevice::MsgReportSampleRate, Message) AudioInputDevice::AudioInputDevice() : - m_audioInput(0), - m_audioUsageCount(0), - m_onExit(false), - m_volume(0.5f), - m_audioFifos() + m_audioInput(0), + m_audioUsageCount(0), + m_onExit(false), + m_volume(0.5f), + m_audioFifos(), + m_managerMessageQueue(nullptr) { connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection); } From de30b367ac1e6e6e5269ced5fa2b21268f224edd Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 22:47:26 -0400 Subject: [PATCH 37/41] audiofilter : Initialize AudioFilter state buffers Initialize the filter state buffers in the constructor so filter processing starts from a defined state rather than reading uninitialized values. This avoids undefined behavior and makes the initial filter output deterministic. Found by cppcheck (uninitMemberVar). Signed-off-by: Robin Getz --- sdrbase/audio/audiofilter.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sdrbase/audio/audiofilter.cpp b/sdrbase/audio/audiofilter.cpp index 5c3b8183d..cb625b432 100644 --- a/sdrbase/audio/audiofilter.cpp +++ b/sdrbase/audio/audiofilter.cpp @@ -33,9 +33,13 @@ const float AudioFilter::m_hpa[3] = {1.000000e+00, 1.667871e+00, -7.156964e-01} const float AudioFilter::m_hpb[3] = {8.459039e-01, -1.691760e+00, 8.459039e-01}; AudioFilter::AudioFilter() : - m_filterLP(m_lpa, m_lpb), - m_filterHP(m_hpa, m_hpb), - m_useHP(false) + m_filterLP(m_lpa, m_lpb), + m_filterHP(m_hpa, m_hpb), + m_useHP(false), + m_lpva{}, + m_lpvb{}, + m_hpva{}, + m_hpvb{} {} AudioFilter::~AudioFilter() From 0639ff2467919e1022968d47856fa6da30a0fe86 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 22:46:14 -0400 Subject: [PATCH 38/41] audiocompressorsnd : Initialize AudioCompressorSnd members Initialize all AudioCompressorSnd data members in the constructor so the compressor state and audio buffers have defined values before use. This prevents undefined behavior from reading uninitialized member variables. Found by cppcheck (uninitMemberVar). Signed-off-by: Robin Getz --- sdrbase/audio/audiocompressorsnd.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/sdrbase/audio/audiocompressorsnd.cpp b/sdrbase/audio/audiocompressorsnd.cpp index d95893e64..cce62ba7c 100644 --- a/sdrbase/audio/audiocompressorsnd.cpp +++ b/sdrbase/audio/audiocompressorsnd.cpp @@ -25,7 +25,25 @@ #include "audiocompressorsnd.h" -AudioCompressorSnd::AudioCompressorSnd() +AudioCompressorSnd::AudioCompressorSnd() : + m_rate(0.0f), + m_pregain(0.0f), + m_threshold(0.0f), + m_knee(0.0f), + m_ratio(0.0f), + m_attack(0.0f), + m_release(0.0f), + m_predelay(0.0f), + m_releasezone1(0.0f), + m_releasezone2(0.0f), + m_releasezone3(0.0f), + m_releasezone4(0.0f), + m_postgain(0.0f), + m_wet(0.0f), + m_compressorState{}, + m_storageBuffer{}, + m_processedBuffer{}, + m_sampleIndex(0) { m_sampleIndex = 0; std::fill(m_processedBuffer, m_processedBuffer+AUDIOCOMPRESSORSND_SF_COMPRESSOR_CHUNKSIZE, 0.0f); From db9bde96195c4a5618485e567ec8de78ba5d8d93 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 23:01:57 -0400 Subject: [PATCH 39/41] aprs : Initialize packet decoding state Initialize APRS packet fields and telemetry buffers so a default-constructed packet has defined values for decoded position, weather, station, telemetry, and other optional data. This prevents undefined behavior when optional fields are accessed before their corresponding presence flags are set. Found by cppcheck (uninitMemberVar). Signed-off-by: Robin Getz --- sdrbase/util/aprs.h | 51 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/sdrbase/util/aprs.h b/sdrbase/util/aprs.h index 97fe59ad8..4981f052c 100644 --- a/sdrbase/util/aprs.h +++ b/sdrbase/util/aprs.h @@ -175,45 +175,96 @@ struct SDRBASE_API APRSPacket { bool decode(AX25Packet packet); APRSPacket() : + m_utc(false), m_hasTimestamp(false), + m_latitude(0.0f), + m_longitude(0.0f), m_hasPosition(false), + m_altitudeFt(0.0f), m_hasAltitude(false), + m_symbolTable(0), + m_symbolCode(0), m_hasSymbol(false), + m_course(0), + m_speed(0), m_hasCourseAndSpeed(false), + m_powerWatts(0), + m_antennaHeightFt(0), + m_antennaGainDB(0), m_hasStationDetails(false), + m_radioRangeMiles(0), m_hasRadioRange(false), + m_dfStrength(0), + m_dfHeightFt(0), + m_dfGainDB(0), m_hasDf(false), m_objectLive(false), m_objectKilled(false), + m_windDirection(0), m_hasWindDirection(false), + m_windSpeed(0), m_hasWindSpeed(false), + m_gust(0), m_hasGust(false), + m_temp(0), m_hasTemp(false), + m_rainLastHr(0), m_hasRainLastHr(false), + m_rainLast24Hrs(0), m_hasRainLast24Hrs(false), + m_rainSinceMidnight(0), m_hasRainSinceMidnight(false), + m_humidity(0), m_hasHumidity(false), + m_barometricPressure(0), m_hasBarometricPressure(false), + m_luminosity(0), m_hasLuminsoity(false), + m_snowfallLast24Hrs(0), m_hasSnowfallLast24Hrs(false), + m_rawRainCounter(0), m_hasRawRainCounter(false), + m_radiationLevel(0), m_hasRadiationLevel(false), + m_floodLevel(0), m_hasFloodLevel(false), + m_batteryVolts(0), m_hasBatteryVolts(false), m_hasWeather(false), + m_stormDirection(0), + m_stormSpeed(0), + m_stormSustainedWindSpeed(0), + m_stormPeakWindGusts(0), + m_stormCentralPresure(0), + m_stormRadiusHurricanWinds(0), + m_stormRadiusTropicalStormWinds(0), + m_stormRadiusWholeGail(0), m_hasStormRadiusWholeGail(false), m_hasStormData(false), + m_beamHeading(0), + m_beamPower(0), m_hasBeam(false), m_hasStatus(false), m_hasMessage(false), + m_telemetryCoefficientsA{}, + m_telemetryCoefficientsB{}, + m_telemetryCoefficientsC{}, m_hasTelemetryCoefficients(0), + m_telemetryBitSense{}, m_hasTelemetryBitSense(false), + m_seqNo(0), m_hasSeqNo(false), + m_a1(0), m_a1HasValue(false), + m_a2(0), m_a2HasValue(false), + m_a3(0), m_a3HasValue(false), + m_a4(0), m_a4HasValue(false), + m_a5(0), m_a5HasValue(false), + m_b{}, m_bHasValue(false), m_hasTelemetry(false) { From 2c5d17e76d99f0952c2ec106b63c2efd879a0964 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 23:01:20 -0400 Subject: [PATCH 40/41] ais : Initialize SAR aircraft heading state Initialize the heading availability flag and heading value so SAR aircraft position reports have defined heading state before the decoded message data is used. This avoids undefined behavior from reading uninitialized members. Found by cppcheck (uninitMemberVar). Signed-off-by: Robin Getz --- sdrbase/util/ais.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sdrbase/util/ais.cpp b/sdrbase/util/ais.cpp index 0bcc78ff4..d68d59ce4 100644 --- a/sdrbase/util/ais.cpp +++ b/sdrbase/util/ais.cpp @@ -531,7 +531,9 @@ AISBinaryBroadcast::AISBinaryBroadcast(QByteArray ba) : } AISSARAircraftPositionReport::AISSARAircraftPositionReport(QByteArray ba) : - AISMessage(ba) + AISMessage(ba), + m_headingAvailable(false), + m_heading(0) { m_altitude = ((ba[4] & 0x3) << 10) | ((ba[5] & 0xff) << 2) | ((ba[6] >> 6) & 0x3); m_altitudeAvailable = m_altitude != 4095; From 89190ffb6957bbec195b01276661e34f5814862a Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 14 Sep 2026 23:32:44 -0400 Subject: [PATCH 41/41] ais : Initialize binary message destination ID Initialize the destination ID so AIS single-slot binary messages have a defined value when no destination is indicated. Found by Coverity (UNINIT_CTOR). Signed-off-by: Robin Getz --- sdrbase/util/ais.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdrbase/util/ais.cpp b/sdrbase/util/ais.cpp index d68d59ce4..ceed68035 100644 --- a/sdrbase/util/ais.cpp +++ b/sdrbase/util/ais.cpp @@ -833,7 +833,8 @@ QString AISStaticDataReport::toString() } AISSingleSlotBinaryMessage::AISSingleSlotBinaryMessage(QByteArray ba) : - AISMessage(ba) + AISMessage(ba), + m_destinationId(0) { m_destinationIndicator = (ba[4] >> 1) & 1; m_binaryDataFlag = ba[4] & 1;