Add DSPAcquisitionError and DSPGenerationError messages to provide a
standard mechanism for SDRangel devices to report asynchronous errors
to their DSP device engines.
These errors occur after normal device initialization or startup and are
not the result of a synchronous start or configuration operation. They
cover conditions such as a device being unplugged or disconnected, a
device becoming unavailable, or an error occurring while acquiring or
generating samples.
Handle DSPAcquisitionError in the DSPDeviceSourceEngine and the
acquisition side of DSPDeviceMIMOEngine, and handle DSPGenerationError
in the DSPDeviceSinkEngine and the generation side of
DSPDeviceMIMOEngine. Transition the affected device engine to the error
state and propagate the device-provided error message.
This allows asynchronous failures in a sample source, sample sink, or
MIMO device to be propagated through the SDRangel device engine state
machine instead of leaving the device engine running after the device
has become unavailable or encountered an unrecoverable error.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
ASAN reported leaked aircraft photos when PlaneSpotters was destroyed.
Delete the cached photos during destruction.
This ensures cached photo objects are released when their owning
PlaneSpotters instance goes away.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
ASAN reported leaked flag and airline icons when OsnDB was destroyed.
Add cleanup functions and release the cached icons during destruction.
This ensures cached icon resources do not outlive the OsnDB instance.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
ASAN reported leaked AirportInformation objects when the airport
database was released. Provide a QSharedPointer deleter that deletes
the objects stored in the database hash.
This ensures airport information is released together with its
containing database.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Unload the dynamically loaded VISA library when the VISA object is
destroyed and ensure radio astronomy VISA sessions are closed first.
Coverity reported a resource leak because `visaLibrary` was loaded with
`LoadLibrary`/`dlopen` but was never released. It also identified
uninitialized VISA function pointers and the library handle.
Initialize the remaining pointers, add platform-specific library cleanup,
and close all radio astronomy instrument sessions before releasing the
default VISA resource manager. The other VISA users were reviewed to
verify that their sessions and default resource managers are also closed
before their VISA objects are destroyed.
The library is only unloaded when no default resource manager session
remains active, avoiding unloading the VISA library while it is still in
use.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
cppcheck reported a possible out-of-bounds access in the BITS telemetry
message parser. The bounds check was reversed, causing m_message[i] to
be accessed when i was beyond the end of the string.
Correct the condition so missing bit sense values continue to use the
existing default value.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
cppcheck reported an out-of-bounds access in APRSPacket::parseItem()
when parsing item names. The parser checked the string length using an
incorrect boundary condition, allowing an index equal to the string
length to be accessed.
Validate the item terminator before indexing the string, and ensure
malformed packets without a valid terminator are rejected. Also simplify
the item name parsing logic while enforcing the APRS 3-9 character item
name limit.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Move the existing empty-trigger check ahead of the access to the
current trigger condition. The previous code indexed
m_triggerConditions before verifying that the container was non-empty,
which could result in an out-of-bounds access.
No functional behavior is changed for the non-empty case.
noticed by cppcheck : Access out of bounds
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Fix cppcheck warning:
Using iterator to member container 'm_sinkBuddies' that may be invalid
clearBuddiesLists() was iterating directly over m_sourceBuddies and
m_sinkBuddies while calling removeBuddy(), which modifies the buddy
relationship lists. This could invalidate the active iterator and result in
undefined behavior.
The issue could lead to intermittent failures during buddy cleanup operations,
such as device removal, device reload, or application shutdown, depending on
container state and timing.
Iterate over copies of the buddy lists so that removing relationships does not
affect the iterators used for traversal.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
In std::vector<T,Allocator>::erase, The iterator pos must be valid and
dereferenceable. Thus the end() iterator (which is valid, but is not
dereferenceable) cannot be used as a value for pos.
Protect against that by checking the result of std::find() before erasing
a buddy entry. The buddy should always be present when removeBuddy() is
called, but avoid undefined behavior if that assumption is violated.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Add default initializers for primitive SpyServer members to avoid
uninitialized values when optional JSON fields are missing.
Fixes cppcheck warnings for uninitialized struct members.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Add default initializers for primitive SDRangelServer members to avoid
uninitialized values when optional JSON fields are not present.
Fixes cppcheck warnings for uninitialized struct members.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Add an in-class default initializer for Layer::m_ongoing to ensure
default-constructed instances always have a defined value.
Fixes the cppcheck warning about an uninitialized struct member when
Layer objects are copied before the optional "ongoing" field is
assigned.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
The signed 64-bit deserialization code used a signed temporary value while
assembling bytes:
tmp = (tmp << 8) | byte;
For negative values, tmp was initialized to -1 for sign extension. Left-shifting
this negative value is undefined behavior in C++.
Use an unsigned temporary while constructing the 64-bit representation and
convert to qint64 after all bytes have been assembled. This preserves the
existing two's complement sign handling while avoiding undefined behavior.
Fixes static analysis warning about shifting a negative value.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
The signed integer deserialization code used a signed temporary value while
assembling bytes:
tmp = (tmp << 8) | byte;
For negative values, tmp was initialized to -1 for sign extension, causing a
left shift of a negative value, which is undefined behavior in C++.
Use an unsigned temporary while constructing the 32-bit representation and
convert to qint32 only after all bytes have been assembled. This preserves the
existing two's complement sign handling while avoiding undefined signed shifts.
Fixes static analysis (cppcheck) warning about shifting a negative value.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Remove an invalid out-of-bounds array access that attempted to handle
ERROR_INSUFFICIENT_BUFFER. The statement did not resize the fixed-size
buffer and had no effect other than invoking undefined behavior.
The function only uses QueryDosDeviceA() as an existence check for COM
ports, so removing the dead error-handling code does not change its
behavior.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
cppcheck reported that GLScopeSettings::operator=() did not assign the
m_freerun member variable.
m_freerun is part of the GLScope configuration state: it is initialized
in resetToDefaults(), and is persisted through serialize()/deserialize().
However, when a GLScopeSettings object was copied using the assignment
operator, the freerun state was not transferred from the source object.
This could result in two GLScopeSettings instances having different
freerun values after assignment, with the destination object retaining
its previous value instead of matching the source object.
Add the missing m_freerun assignment to ensure operator=() performs a
complete copy of the settings state and matches the existing
serialization behavior.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
The MeshCore mod plugin references SWGMeshcoreModActions in
meshcoremod.cpp, but MeshcoreMod.yaml had no MeshcoreModActions
section. When swagger files are regenerated, the auto-generated
SWGChannelActions.h/cpp lose the meshcore_mod_actions member and
accessors, which would break compilation of meshcoremod.cpp.
Changes across five files:
- MeshcoreMod.yaml: add MeshcoreModActions definition (sendNow
field, matching existing hand-authored SWGMeshcoreModActions)
- ChannelActions.yaml: add MeshcoreModActions pointing to
the new section
- SWGModelFactory.h: add #include and create() registration
block for SWGMeshcoreModActions (was missing despite
SWGMeshcoreModSettings/MeshcoreDemod* being registered)
- webapirequestmapper.cpp: add channelActionsKey routing branch
for MeshcoreModActions (was completely absent)
- webapiutils.cpp: add m_channelURIToSettingsKey and
m_channelTypeToSettingsKey entries for both MeshcoreDemod and
MeshcoreMod (were missing, unlike ChirpChat and Meshtastic
which have entries for their channel types)
Previously, devices claimed by another device set were omitted from the
device selection lists. Display these devices as disabled and marked
"[in use]" instead of hiding them.
Signed-off-by: Robin Getz <rgetz503@gmail.com>