mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-07-26 03:54:30 -04:00
FT8: Fix potential integer overflow in band preset frequency calculation
Fix Coverity CID 649215 (OVERFLOW_BEFORE_WIDEN) by ensuring the band preset frequency calculation is widened to 64-bit before converting kHz to Hz. This prevents a potential 32-bit intermediate overflow when applying band presets (which is likely not a real issue, but it keeps the analyzer happy). Signed-off-by: Robin Getz <rgetz503@gmail.com>
This commit is contained in:
@@ -453,7 +453,7 @@ void FT8DemodGUI::on_applyBandPreset_clicked()
|
||||
int bandPresetIndex = ui->bandPreset->currentIndex();
|
||||
int channelShift = m_settings.getBandPresets(m_settings.m_decoderMode)[bandPresetIndex].m_channelOffset; // kHz
|
||||
int baseFrequency = m_settings.getBandPresets(m_settings.m_decoderMode)[bandPresetIndex].m_baseFrequency; // kHz
|
||||
quint64 deviceFrequency = (baseFrequency - channelShift)*1000; // Hz
|
||||
quint64 deviceFrequency = static_cast<quint64>(baseFrequency - channelShift) * 1000; // Hz
|
||||
m_ft8Demod->setDeviceCenterFrequency(deviceFrequency, m_settings.m_streamIndex);
|
||||
|
||||
if (channelShift * 1000 != m_settings.m_inputFrequencyOffset)
|
||||
|
||||
Reference in New Issue
Block a user