Initialize the previously uninitialized m_workspaceIndex member to zero to
eliminate the cppcheck UNINIT_CTOR warning and ensure the workspace index
starts in a defined state.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the AGC and bias tee state to false to eliminate cppcheck
UNINIT_CTOR warnings and ensure DeviceGains starts in a defined state.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize previously uninitialized VorLocalizerWorker state members to defined
values to eliminate cppcheck UNINIT_CTOR warnings. This ensures VOR ranges,
round-robin device and channel state, turn plans, and channel allocations start
in a known state and avoids undefined behavior from reading uninitialized data.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize previously uninitialized VORChannel and AvailableChannel members to
defined values to eliminate cppcheck UNINIT_CTOR warnings. This ensures channel
configuration and API state start in a known state and avoids undefined behavior
from reading uninitialized values.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize previously uninitialized VORChannelReport radial, magnitude, and
validity members to defined values to eliminate cppcheck UNINIT_CTOR warnings.
This ensures channel reports start in a known state and avoids undefined
behavior from reading uninitialized values.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the previously uninitialized m_rgbColor member to black to eliminate
the cppcheck UNINIT_CTOR warning. This ensures the map color starts in a defined
state and avoids undefined behavior from reading an uninitialized value.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize previously uninitialized ObjectMapModel display and longitude members to
defined values to eliminate cppcheck UNINIT_CTOR warnings. This ensures display
options and map view state start in a known state and avoids undefined behavior
from reading uninitialized members.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the previously uninitialized aircraft state and roll members to
defined values to eliminate cppcheck UNINIT_CTOR warnings. This ensures the
stored aircraft state starts in a known state and avoids undefined behavior
from reading uninitialized values.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize previously uninitialized AvailableChannel members to defined values
to eliminate cppcheck UNINIT_CTOR warnings. This ensures channel state and
API pointers start in a known state and avoids undefined behavior from
reading uninitialized members.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the previously uninitialized m_running member to false to eliminate
the cppcheck UNINIT_CTOR warning. This ensures the worker starts in a defined
stopped state and avoids undefined behavior from reading uninitialized state.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize previously uninitialized DemodAnalyzerWorker members to defined
values to eliminate cppcheck UNINIT_CTOR warnings. This ensures magnitude
tracking and scope visualization state start in a known state and avoids
undefined behavior from reading uninitialized members.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize previously uninitialized APRSStation telemetry coefficient, bit sense,
and state members to defined values to eliminate cppcheck UNINIT_CTOR warnings.
This ensures telemetry data starts in a known state and avoids undefined behavior
from reading uninitialized values.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize previously uninitialized UDPSourceSource magnitude and level members
to safe default values to eliminate cppcheck UNINIT_CTOR warnings. This ensures
input magnitude and level tracking start in a defined state and avoids undefined
behavior from reading uninitialized data.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize previously uninitialized RttyModSource members to safe default values
to eliminate cppcheck UNINIT_CTOR warnings. This ensures bit and level state,
sample and bit counters, and the GUI message queue start in a defined state
and avoids undefined behavior from reading uninitialized data.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the previously uninitialized m_writeToFile member to false to
eliminate the cppcheck UNINIT_CTOR warning and ensure the file-writing option
starts in a defined state.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize previously uninitialized PSK31Source members to safe default values
to eliminate cppcheck UNINIT_CTOR warnings. This ensures symbol state, level
tracking, sample indexing, and the GUI message queue start in a defined state
and avoids undefined behavior from reading uninitialized data.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize previously uninitialized PacketModSource members to safe default
values to eliminate cppcheck UNINIT_CTOR warnings. This ensures modulation
state, level tracking, counters, and the transmit bit buffer start in a
defined state and avoids undefined behavior from reading uninitialized data.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the previously uninitialized DCS word, polarity, and bit-per-step
members to defined values to eliminate cppcheck UNINIT_CTOR warnings. This
ensures the DCS modulator starts with a defined state before reset() and
subsequent modulation operations.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the previously uninitialized RMS and peak output level members to
zero to eliminate cppcheck UNINIT_CTOR warnings. Also correct the indentation
of the existing level member initializers for consistent formatting and
readability.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the previously uninitialized spread factor and deinterleaving bit
members to zero to eliminate cppcheck UNINIT_CTOR warnings. This ensures
the encoder starts with a defined configuration state before its settings
are applied.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the previously uninitialized RMS and peak output level members to
zero to eliminate cppcheck UNINIT_CTOR warnings. Also correct the indentation
of the existing level member initializers for consistent formatting and
readability.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the previously uninitialized spread factor and deinterleaving bit
members to zero to eliminate cppcheck UNINIT_CTOR warnings. This ensures
the encoder starts with a defined configuration state before its settings
are applied.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the MPEG transport stream, IQ symbol, and UDP buffers to zero to
eliminate cppcheck UNINIT_CTOR warnings. This ensures the buffers have a
defined initial state before they are accessed during DATV modulation and
avoids undefined behavior from reading uninitialized data.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Handle the case where the coarse period search finds no valid period before
using the result in the least squares refinement. Without this check, a zero
period could be used as a divisor and cause undefined behavior.
Fix Coverity CID 653822.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Validate the sendMessage payload before accessing the callsign and text
fields. A malformed packet without a callsign terminator could cause an
out-of-bounds read when accessing the text field, potentially crashing
SDRangel.
Also reject zero-length payloads before accessing the broadcast byte.
Fix Coverity CID 652660.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize previously uninitialized DVBS members to safe default values to
eliminate cppcheck UNINIT_CTOR warnings and prevent undefined behavior from
reading uninitialized state.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize previously uninitialized DATVModSource members to safe default
values to eliminate cppcheck UNINIT_CTOR warnings and prevent undefined
behavior from reading uninitialized state.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the previously uninitialized RMS and peak level members to
safe default values to eliminate cppcheck UNINIT_CTOR warnings and
prevent undefined behavior from reading uninitialized state.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize the previously uninitialized message type to MessageNone to
eliminate the cppcheck UNINIT_CTOR warning and ensure the member has a
defined value before resetToDefaults() is called.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize previously uninitialized ChirpChatModEncoder members to safe
default values to eliminate cppcheck UNINIT_CTOR warnings and prevent
undefined behavior from reading uninitialized state.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize previously uninitialized ATVModSource members to safe default
values to eliminate cppcheck UNINIT_CTOR warnings and uninitialized member
warnings reported by Coverity (UNINIT_CTOR). and prevent undefined behavior
from reading uninitialized state.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize previously uninitialized LocalSourceSource members to safe
default values to eliminate cppcheck UNINIT_CTOR warnings and prevent
undefined behavior from reading uninitialized state.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
MapSettings owns the MapItemSettings objects stored in m_itemSettings, but
the destructor previously did not release them. Enabling the cleanup also
exposed that MapSettings was implicitly shallow-copying these raw pointers,
allowing multiple MapSettings instances to reference the same
MapItemSettings objects.
Add explicit copy construction and assignment so each MapSettings instance
gets its own MapItemSettings objects. Serialize and deserialize the settings
to perform the deep copy while preserving the existing rollup state.
When deserializing item settings into an existing MapSettings instance,
update existing MapItemSettings objects in place instead of replacing their
pointers. MapItem objects retain pointers to these settings, so preserving
pointer identity prevents those references from becoming dangling.
Release all MapItemSettings objects when MapSettings is destroyed.
This fixes the AddressSanitizer leak from MapSettings while avoiding the
use-after-free that occurs when the owned settings are deleted while other
MapSettings copies still reference the same objects.
Found by AddressSanitizer.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
MapModel owns the MapItem objects stored in m_items, but several
destruction paths previously removed objects from the model without
releasing them. ObjectMapItem also owns the track coordinates and
timestamps accumulated by updateTrack().
AddressSanitizer reported:
Direct leak of 29006400 byte(s) in 72516 object(s) allocated from:
#0 <addr> in operator new(unsigned long)
../../../../src/libsanitizer/asan/asan_new_delete.cpp:95
#1 <addr> in ObjectMapModel::newMapItem(QObject const*, QString const&, MapSettings::MapItemSettings*, SWGSDRangel::SWGMapItem*)
./plugins/feature/map/mapmodel.cpp:427
The map update path removes an item permanently when its image becomes
empty. MapModel::remove() only removes the object from the model and hash,
so the object must be deleted after it has been removed and the 3D map has
been updated.
Also release all remaining MapItem objects when clearing or destroying
the model. MapItem has a virtual destructor so derived ObjectMapItem
instances are destroyed correctly through the MapItem pointer.
ObjectMapItem owns the QGeoCoordinate and QDateTime objects stored in its
track lists, so release those objects when the ObjectMapItem is destroyed.
The interpolated coordinate list is not deleted separately because it
references entries from m_takenTrackCoords.
Found by AddressSanitizer.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
MapGUI owns the Aurora instance and the IonosondeStation objects stored in
m_ionosondeStations, but neither was released when MapGUI was destroyed.
AddressSanitizer reported:
Direct leak of 3232 byte(s) in 101 object(s)
#1 MapGUI::giroDataUpdated(...) mapgui.cpp:852
It also reported an indirect leak originating from the QNetworkAccessManager
created by Aurora:
Indirect leak of 376 byte(s) in 1 object(s)
#1 QNetworkAccessManager::QNetworkAccessManager(...)
#2 Aurora::create(...) aurora.cpp:314
Delete the Aurora instance and all stored IonosondeStation objects when
destroying MapGUI so their owned resources are released with the GUI.
Found by AddressSanitizer.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
WebServer owns the substitution lists and the Substitution objects stored
in those lists. The destructor previously deleted only the heap-allocated
QList objects, leaving each Substitution allocated by addSubstitution()
leaked.
AddressSanitizer reported:
Direct leak of 16 byte(s) in 1 object(s) allocated from:
#0 <addr> in operator new(unsigned long)
../../../../src/libsanitizer/asan/asan_new_delete.cpp:95
#1 <addr> in WebServer::addSubstitution(QString, QString, QString)
./plugins/feature/map/webserver.cpp:70
Fix deletes the Substitution objects before deleting their containing lists
so the complete substitution hierarchy is released when WebServer is
destroyed.
Found by AddressSanitizer.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
The same fix as da31464dd for the plugins whose applySettings takes the key list first, which
that sweep missed: 35 channels, modulators, sinks, sources and one MIMO device copied the
whole settings struct on every message, so a GUI message with no keys arriving just after an
API patch put the old values back. The DSD demodulator lost the deviation set at creation
this way.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
listen modes dmr, dpmr, dstar, ysf, nxdn and nxdn24 set the DSD demodulator's FM deviation and
baud rate to what the standard needs, from the plugin readme's table, and dmr switches on both
time slots. Plain dsd sets the defaults explicitly so a retuned demodulator gets them too.
record_iq waited for nothing between patching the FileSink's file name and posting the record
action, and the action reaches the DSP thread ahead of settings routed through the channel, so
the sink recorded briefly to its old, empty name, leaving a .<timestamp>.sdriq in the working
directory. The file name is now confirmed on the channel before recording starts, and a bad
name is refused before a FileSink is added for it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A feature listen added is kept while any channel of a type that feeds it exists, whoever
added it, so cleanup cannot take away a feature the user's own decoder is using.
A repeated listen in a paired mode retunes both demodulators rather than reclaiming and
recreating them: reuse is allowed when the intent channels of the type number what the mode
uses, and the partner is kept through the reclaim.
The capture path check resolves the nearest existing ancestor of the target to where the file
system really puts it, so a symbolic link or junction under the capture directory cannot lead
a recording outside it. Qt's canonical path does not see through a junction on Windows, so
the final path is asked of the system there.
The bridge remembers the resources the client subscribed to and subscribes again whenever it
rebuilds a session after SDRangel restarts, so updates carry on arriving.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
These keyed applySettings copied the whole settings struct on every message. A GUI sends
messages with no keys while its window is being laid out, carrying its own copy of the
settings, and one arriving after an API patch but before the GUI has seen it wrote the old
values back, so the patched value was lost and the API read back what it had replaced. The AIS
demodulator lost the inputFrequencyOffset set at creation this way.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
listen tracks the features it adds for a mode's output (AIS, Radiosonde, APRS) by UID, as it
does channels. The next listen or scan with replace removes one once no channel the intent tools
added still feeds it, on any device set, and cleanup removes the rest and lists them. A feature
that was already there is never tracked.
New listen modes: aprs, a PacketDemod with the APRS feature, and packet for the demodulator
alone. AIS is received on two channels, so listen ais centres the device on the frequency given
and puts a demodulator at each of -25 and +25 kHz, and the partner is counted as this call's
rather than reported as a leftover. arrange_workspace posts the new WorkspaceActions. The
settling loop tolerates a demodulator with no channel report instead of failing the call.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Each had a report definition in the swagger includes and a generated SWG class, but no
webapiReportGet, so the API answered 501. All five now report the channel power in dB and the
channel sample rate, as the pager demodulator does.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
listen and scan measure and set the receiver gain, as tune_gain does, when
they create a device set or move one to another band, and leave it alone on
a move within a band or a change of mode, or when told tuneGain false. On a
new device set this replaces the fixed 40 dB profile, which stays only when
tuning is declined.
A retune moves every channel on the device set, since each is an offset from
the centre. Channels the intent tools did not add are now kept on the
frequency they had, by moving their offset, where the new baseband still
holds them; an audio demodulator it cannot hold is removed, since all it
could do is play noise; a file sink, an analyser or anything else without
audio is left in place and named in the reply. The offset key is read from
the channel's own settings, as it differs by type.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
tune_gain steps a device through its gain range, measuring the noise floor
and the strongest signal on the main spectrum at each, and applies the gain
where the signal stands furthest above the floor, or, on a quiet band, the
lowest gain at which the antenna's noise rather than the converter's sets
the floor, short of overload. It knows the RTL-SDR, HackRF, Airspy, LimeSDR,
PlutoSDR and USRP, and takes a gain key and values for anything else.
scan steps by the channel spacing usual for the mode unless told otherwise,
refuses modes on fixed frequencies, measures its threshold from the floor
rather than assuming one, and reports every active frequency rather than the
five strongest and where the scanner happened to park. Broadcast FM is
scanned on its 100 kHz raster whatever step is given, with only the local
peaks reported, and listen and scan give it a 512 kS/s baseband with the
channel clear of the DC spike. pager, sonde and dsc modes are added.
listen retunes a demodulator of the right type a previous call added rather
than replacing it, and applies the RTL-SDR receiver profile only to a device
set it created. set_spectrum_settings reads the settings back and says when
a value was rounded or an averaging mode is set with nothing to average over.
get_spectrum_data returns its power array, which the generated serialiser had
been dropping.
describe_settings covers the spectrum display, and list_docs and get_docs
serve the GUI's own pages: the spectrum, its markers, measurements and
calibration, the main spectrum window, audio, configurations, device user
arguments and the transverter dialog.
The receiving guide gains sections on scanning, where each mode's output
appears and how long to wait for it, judging signal levels, gain, the
frequencies asked for by name including the DAB blocks, and the RTL-SDR's
limits on HF.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
listen only remembered the one channel its previous call added to a device
set, and scan remembered nothing, so exploring a band with both left a trail
of demodulators all playing audio and a Frequency Scanner still sweeping.
Both now register the channels they add, by uid so that a channel removed
from the GUI and another allocated at its address are not confused. replace,
now on scan as well, removes every such channel on the device set first, and
a new cleanup tool removes them all. Channels added any other way are never
touched; the reply says which of them the retune may have left outside the
baseband, and how to retune or remove them.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>