1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-08-11 14:03:56 -04:00
Commit Graph

11284 Commits

Author SHA1 Message Date
Robin Getz bb01f58f28 demodvormc: Fix uninitialized variable phase in radial calculation
Coverity reported an uninitialized scalar use of varPhase when the
reference and variable Goertzel filters completed at different times.
Store the last valid variable phase and magnitude values to ensure the
radial calculation always uses initialized data.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-02 20:39:51 -04:00
Robin Getz d4f36753ed remotetcpinput: Avoid using uninitialized converter buffer
Coverity reported that an invalid sample size could leave the
conversion buffer uninitialized before it was passed to calcPower()
and the sample FIFO.

Return early when the sample conversion format is unsupported to
prevent processing invalid data.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-02 20:39:50 -04:00
Robin Getz 5a02fe67ed wdsp: Fix uninitialized curve samples in FCurve::fc_impulse
cppcheck reported that unsupported curve types could leave entries in the
frequency curve array uninitialized before being passed to the FIR generator.

Add a default switch case to initialize curve samples to zero and avoid
propagating undefined values.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-02 19:05:37 -04:00
Robin Getz ee24189bd2 modais: Initialize output bytes before HDLC bit packing
The HDLC encoder accumulated bits into m_bits using the |= operator
without first initializing the first byte. This resulted in an
uninitialized read of m_bits[0] when encoding the first bit of a
packet.

Initialize each output byte when writing its first bit, ensuring the
buffer contains a defined value before bits are OR'ed into it. This
also makes addBit() self-contained, eliminating the need for callers to
pre-initialize the current output byte.

Reported by Coverity.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-02 18:53:58 -04:00
Robin Getz 862e838b65 modais: Initialize remaining AISModSource members
Cppcheck reported several AISModSource members that were not initialized
by the constructor. Initialize the remaining scalar members in the
constructor initializer list to establish a well-defined initial state
and avoid undefined behavior if they are accessed before being assigned.

Reported by cppcheck.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-02 18:52:10 -04:00
Edouard Griffiths f6ed9b8cb3 Merge pull request #2868 from rgetz/rgetz-fix-copypaste
vorlocalizer: Fix round robin plan sorting comparator
2026-08-02 16:21:00 +02:00
Edouard Griffiths e31601da42 Merge pull request #2867 from rgetz/rgetz-fix-signConversion
valuedialz: Fix signed/unsigned conversion when editing negative values
2026-08-02 14:49:56 +02:00
Edouard Griffiths d4bc19d912 Merge pull request #2865 from rgetz/rgetz-fix-invalidContainer
Fix two potential undefined behavior issues in `DeviceAPI` buddy list management.
2026-08-02 06:12:49 +02:00
Edouard Griffiths 744bb7e18d Merge pull request #2862 from rgetz/rgetz-fix-remaining-vlas
Remove remaining variable length arrays from demoddatv/ldpctool/generic.h
2026-08-02 05:30:31 +02:00
Edouard Griffiths f72133eee0 Merge pull request #2866 from rgetz/rgetz-fix-memsetClass
leansdr: Properly initialize QPSK hist buffer
2026-08-02 02:17:33 +02:00
Robin Getz d122e69fba ldpctool: Remove VLAs from SumProductAlgorithm
Replace variable length arrays in SumProductAlgorithm::finalp() with a
std::vector buffers.

This removes reliance on compiler VLA extensions while preserving the
existing contiguous temporary buffer layout.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-01 19:48:46 -04:00
Robin Getz 85021508f1 ldpctool: Remove VLAs from LambdaMinAlgorithm
Replace variable length arrays in LambdaMinAlgorithm::finalp() with
std::vector storage.

Update nth_element() usage to operate on vector iterators while removing
the non-standard VLA usage.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-01 19:48:46 -04:00
Robin Getz e4561aeb77 ldpctool: Remove VLAs from LogDomainSPA
Replace variable length arrays in LogDomainSPA::finalp() with
std::vector buffers.

This removes reliance on compiler VLA extensions while preserving the
existing contiguous temporary buffer layout.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-01 19:48:46 -04:00
Robin Getz 7e26f86aa6 ldpctool: Remove VLAs from MinSumCAlgorithm<int8_t, FACTOR>
Replace the variable length temporary array in the int8_t FACTOR
specialization of MinSumCAlgorithm::finalp() with a std::vector buffer.

This removes reliance on compiler VLA extensions and uses standard C++
storage for the temporary reduction buffer.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-01 19:48:45 -04:00
Robin Getz 8ac0485e53 ldpctool: Remove VLAs from MinSumCAlgorithm<float, FACTOR>
Replace the variable length temporary array in the float FACTOR
specialization of MinSumCAlgorithm::finalp() with a std::vector buffer.

This removes reliance on compiler VLA extensions and uses standard C++
storage for the temporary reduction buffer.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-01 19:48:45 -04:00
Robin Getz 4ccc7a9bfd ldpctool: Remove VLA from MinSumCAlgorithm
Replace the variable length temporary array in MinSumCAlgorithm::finalp()
with a std::vector buffer.

This removes reliance on compiler VLA extensions and uses standard C++
storage for the temporary reduction buffer.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-01 19:48:44 -04:00
Robin Getz 4b3bf21418 ldpctool: Remove VLAs from OffsetMinSumAlgorithm<int8_t, FACTOR>
Replace variable length arrays in the int8_t FACTOR specialization of
OffsetMinSumAlgorithm::finalp() with a single std::vector scratch buffer.

This removes reliance on compiler VLA extensions while preserving the
existing contiguous temporary buffer layout.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-01 19:48:44 -04:00
Robin Getz 1f62875563 ldpctool: Remove VLAs from OffsetMinSumAlgorithm
Replace variable length arrays in OffsetMinSumAlgorithm::finalp() with a
std::vector buffers.

This removes reliance on compiler VLA extensions while preserving the
existing contiguous temporary buffer layout.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-01 19:48:44 -04:00
Robin Getz 6de853d3d1 ldpctool: Remove VLAs from MinSumAlgorithm<int8_t>
Replace variable length arrays in the int8_t specialization of
MinSumAlgorithm::finalp() with a single std::vector scratch buffer.

This removes reliance on compiler VLA extensions while preserving the
existing contiguous temporary buffer layout.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-01 19:48:43 -04:00
Robin Getz a1391d52a2 ldpctool: Remove VLAs from MinSumAlgorithm<float>
Replace variable length arrays in the float specialization of
MinSumAlgorithm::finalp() with std::vector storage.

This removes reliance on compiler VLA extensions and keeps the
temporary buffers managed by standard C++ containers.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-01 19:48:32 -04:00
Robin Getz bef0b8184e vorlocalizer: Fix round robin plan sorting comparator
The channel count comparison in getChannelsByDevice() accidentally used
the first plan's channel count for both operands. This caused the comparator
to always treat the channel counts as equal and sort only by bandwidth.

Use the second plan's channel count when comparing RRTurnPlans so plans are
ordered correctly by number of channels before applying the bandwidth
tie-breaker.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-01 19:16:31 -04:00
Robin Getz 1a85082dac ldpctool: Remove VLAs from MinSumAlgorithm
Replace variable length arrays in MinSumAlgorithm::finalp() with a
std::vector buffers.

Variable length arrays are a compiler extension and are not part of
standard C++. The replacement preserves the existing contiguous memory
layout while avoiding non-standard stack allocations.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-01 18:44:26 -04:00
Robin Getz bdf0fa0202 valuedialz: Fix signed/unsigned conversion when editing negative values
Fix a signed/unsigned arithmetic issue in ValueDialZ::keyPressEvent()
reported by cppcheck.

The digit editing code used quint64 intermediates together with a signed
sign value:

    int sign = m_value < 0 ? -1 : 1;
    setValue(sign * v);

When editing negative values, the signed -1 was converted to an unsigned
value before multiplication, causing the result to wrap instead of
producing a negative value.

Use qint64 intermediates for the digit manipulation and apply the existing
sign explicitly when updating the value. This preserves correct behavior
when editing negative values and avoids the unintended unsigned conversion.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-01 18:05:44 -04:00
Edouard Griffiths 8e08489521 Merge pull request #2863 from rgetz/rgetz-fix-shiftNegativeLHS
fix undefined behavior related to left-shifting negative values, as reported by cppcheck.
2026-08-01 23:44:46 +02:00
Robin Getz fe22e92c29 leansdr: Properly initialize QPSK hist buffer
Replace raw memset() initialization of hist with C++ value initialization.
This avoids bypassing std::complex object initialization and ensures the
history buffer contains valid constructed objects when HIST_FLOAT is enabled.

The previous memset() relied on the in-memory representation of
std::complex<float> and could leave non-trivial objects improperly
initialized. While this typically behaved as expected with common
implementations, it was not valid C++ object initialization.

pointed out by cppcheck as:
    Using 'memset' on struct that contains a 'std::complex'

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-01 17:26:51 -04:00
Robin Getz 0928de3b7b deviceapi: Avoid iterator invalidation when clearing buddy lists
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>
2026-08-01 17:06:39 -04:00
Robin Getz 11be1bb1e7 deviceapi: Avoid invalid iterator erase in removeBuddy
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>
2026-08-01 16:44:34 -04:00
Robin Getz 1330a0639d Fix undefined left shift in SimpleDeserializer::readS64
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>
2026-08-01 15:10:48 -04:00
Robin Getz 742746dc7b Fix undefined shift in SimpleDeserializer::readS32
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>
2026-08-01 15:01:21 -04:00
Robin Getz 5df5469cc2 leansdr : Fix undefined shift behavior in GF(2^N) arithmetic
The gf2n implementation used a left shift on a potentially negative
value when masking field elements:

    (~(Te)0) << N

This can result in undefined behavior for signed integer types and was
reported by static analysis (cppcheck).

Require the field element type to be unsigned and replace the mask
generation with an explicit N-bit mask constructed from the element type.
Also make the overflow check use the element type to avoid implicit
signed integer operations.

Add comments documenting the packed polynomial representation and the
GF(2^N) reduction steps to clarify the intent of the bit operations.

Fixes static analysis warning about shifting negative values.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-01 14:49:19 -04:00
Edouard Griffiths c9c95398f3 Merge pull request #2861 from rgetz/rgetz-fix-funcArgOrderDifferent
Fix cppcheck-reported function argument order mismatches
2026-08-01 16:02:24 +02:00
Edouard Griffiths 41c1805cda Merge pull request #2860 from rgetz/rgetz-fix-invalidFunctionArg
gui: Explicitly call QSlider::setRange in LogSlider constructor
2026-08-01 14:11:21 +02:00
Edouard Griffiths e7d6fb1000 Merge pull request #2859 from srcejon/fixes
ADS-B Demod: Support OpenSky authentication and decoder fixes
2026-08-01 13:09:57 +02:00
Robin Getz 09980d9782 APRSGUI: Fix displayTableSettings argument order
cppcheck reported that the displayTableSettings() declaration argument
order differed from the function definition. The header declared the
arguments as (columnIndexes, columnSizes), while the implementation and
all call sites use (columnSizes, columnIndexes).

Update the declaration to match the implementation and remove ambiguity
between the table column width and ordering arrays.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-07-31 21:02:23 -04:00
Robin Getz e3cf04b227 Fix RadioAstronomyGUI addToPowerFilter argument order
cppcheck reported that the addToPowerFilter() declaration argument
order differed from the function definition. The header declared the
arguments as (y, x), while the implementation and all call sites use
(x, y).

Update the declaration to match the implementation and callers to avoid
confusion and potential misuse of the function arguments.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-07-31 20:59:42 -04:00
Robin Getz 6fc50d2546 gui: Avoid log(0) in FFTNRDialog::setAlpha
Cppcheck reported that setAlpha() could call log() with an argument of
zero when alpha is clamped to 0.0f, resulting in an invalid-domain
mathematical operation.

Initialize tau to 0.0f and only compute the logarithm when alpha is
strictly positive. This preserves the existing behavior while avoiding
the invalid log(0) call.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-07-31 20:51:36 -04:00
Robin Getz 1253697801 gui: Explicitly call QSlider::setRange in LogSlider constructor
cppcheck identified that LogSlider::LogSlider() calls the derived
setRange(double, double) overload instead of QSlider::setRange(int, int)
due to C++ name hiding.

The constructor's call to:
    setRange(0, 1000);

was therefore invoking the logarithmic range implementation with
min == 0.0, resulting in a call to log10(0). While most callers
immediately replace the initial state by calling LogSlider::setRange()
with a valid positive range, the constructor still performs an invalid
mathematical operation during initialization.

Explicitly qualify the call as QSlider::setRange(0, 1000) to initialize
the underlying slider without invoking the logarithmic overload. This
eliminates the invalid-domain call, avoids undefined behavior from
propagating exceptional floating-point values into the slider state, and
makes the constructor's intent explicit.

This change has no functional impact on normal operation, but removes a
latent initialization bug and prevents future regressions caused by
overload hiding.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-07-31 20:37:23 -04:00
Jon Beniston 6f732293ec Fix formatting 2026-07-31 01:36:56 +01:00
Jon Beniston 3e986af4bc Fix a few decoding errors and small memory leaks. 2026-07-31 00:55:40 +01:00
Jon Beniston 84e7304d05 Fix encoding of + 2026-07-30 22:59:14 +01:00
Jon Beniston 9dfd11b2f5 Use latest settings when forced. 2026-07-30 22:56:44 +01:00
Jon Beniston 26f18e7402 Support OpenSky OAuth authentication. 2026-07-30 18:59:01 +01:00
Jon Beniston e27d41da1a Use stored mode-S identity. 2026-07-30 18:36:45 +01:00
Jon Beniston 703a1b6a29 Fix MSB of beast timestamp. 2026-07-30 18:30:32 +01:00
Jon Beniston 6287e4ac18 Add support for Mode-S short frames to Beast output 2026-07-30 18:29:54 +01:00
Jon Beniston 0e070d9881 Use latest settings when calculating interpolation filter 2026-07-30 18:29:18 +01:00
Jon Beniston a92c944c2c Fix opensky groundspeed and vertical rate. 2026-07-30 18:17:58 +01:00
Jon Beniston ea7571b31f m_exportServerPort is an int not a bool 2026-07-30 18:10:46 +01:00
Edouard Griffiths d91046b2f0 Merge pull request #2858 from rgetz/rgetz-fix-syntax-err
appbench, appsrv: Fix malformed QCoreApplication::applicationVersion()
2026-07-28 23:00:45 +02:00
Edouard Griffiths db89bd9b64 Merge pull request #2857 from rgetz/rgetz-cleanup-printf-format-specifiers
cleanup printf format specifiers
2026-07-28 13:11:21 +02:00