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>
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>
Added optional scrollbar to be able to scroll back through waterfall.
When scrolling is enabled:
Can adjust power scale for complete waterfall, not just future spectra.
Waterfall time axis can use local time or UTC.
Waterfall not lost when resizing window.
Can now zoom when device is stopped.
Added Min averaging type.
Added button to load spectrum from .csv file.
Add button to save spectrum/waterfall to .png or jpg.
Changed show all controls button to a combobox with choices of Min/Std/All (Minimum/Standard/All).
Changed some buttons in spectrum GUI from QPushButton to QToolButton so their size matches the others.
Fix spectrum from displaying a mixture of old and new spectrums (m_currentSpectrum was a pointer to SpectrumVis buffer).
Added M1 and M2 memories to allow display of reference spectra.
Added math operations to allow spectrum to be difference of current spectrum and either memory or a moving average.
Fixed measurement counts, so they are performed once per spectrum, not on displayed spectra.
Added spectrum mask measurement, to check when a spectrum exceeds mask held in M1 or M2.
Optionally display power/frequency under cursor in status line.
Optionally display peak power/frequency in status line.
Fix incorrect nyquist sample replication, when zoom used.
Fix cursor not changing from resize to pointer when moving over spectrum measurements window.
Add spectrum colour setting.