1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-18 21:23:02 +00:00

Fix defects detected by Coverity Scan 2021.12.1: Unintentional integer overflow

overflow_before_widen: Potentially overflowing expression this->d_fft_size * ninput_items[0UL] with type unsigned int (32 bits, unsigned) is evaluated using 32-bit arithmetic, and then used in a context that expects an expression of type uint64_t (64 bits, unsigned)
This commit is contained in:
Carles Fernandez 2022-02-16 11:34:12 +01:00
parent d58720ea58
commit 48b5538269
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
5 changed files with 14 additions and 14 deletions

View File

@ -216,7 +216,7 @@ int galileo_pcps_8ms_acquisition_cc::general_work(int noutput_items,
d_state = 1;
}
d_sample_counter += static_cast<uint64_t>(d_fft_size * ninput_items[0]); // sample counter
d_sample_counter += static_cast<uint64_t>(d_fft_size) * ninput_items[0]; // sample counter
consume_each(ninput_items[0]);
break;
@ -368,7 +368,7 @@ int galileo_pcps_8ms_acquisition_cc::general_work(int noutput_items,
d_active = false;
d_state = 0;
d_sample_counter += d_fft_size * ninput_items[0]; // sample counter
d_sample_counter += static_cast<uint64_t>(d_fft_size) * ninput_items[0]; // sample counter
consume_each(ninput_items[0]);
acquisition_message = 1;
@ -403,7 +403,7 @@ int galileo_pcps_8ms_acquisition_cc::general_work(int noutput_items,
d_active = false;
d_state = 0;
d_sample_counter += static_cast<uint64_t>(d_fft_size * ninput_items[0]); // sample counter
d_sample_counter += static_cast<uint64_t>(d_fft_size) * ninput_items[0]; // sample counter
consume_each(ninput_items[0]);
acquisition_message = 2;

View File

@ -226,7 +226,7 @@ int pcps_cccwsr_acquisition_cc::general_work(int noutput_items,
d_state = 1;
}
d_sample_counter += static_cast<uint64_t>(d_fft_size * ninput_items[0]); // sample counter
d_sample_counter += static_cast<uint64_t>(d_fft_size) * ninput_items[0]; // sample counter
consume_each(ninput_items[0]);
break;
@ -389,7 +389,7 @@ int pcps_cccwsr_acquisition_cc::general_work(int noutput_items,
d_active = false;
d_state = 0;
d_sample_counter += static_cast<uint64_t>(d_fft_size * ninput_items[0]); // sample counter
d_sample_counter += static_cast<uint64_t>(d_fft_size) * ninput_items[0]; // sample counter
consume_each(ninput_items[0]);
acquisition_message = 1;
@ -424,7 +424,7 @@ int pcps_cccwsr_acquisition_cc::general_work(int noutput_items,
d_active = false;
d_state = 0;
d_sample_counter += static_cast<uint64_t>(d_fft_size * ninput_items[0]); // sample counter
d_sample_counter += static_cast<uint64_t>(d_fft_size) * ninput_items[0]; // sample counter
consume_each(ninput_items[0]);
acquisition_message = 2;

View File

@ -680,7 +680,7 @@ int pcps_opencl_acquisition_cc::general_work(int noutput_items,
d_state = 1;
}
d_sample_counter += static_cast<uint64_t>(d_fft_size * ninput_items[0]); // sample counter
d_sample_counter += static_cast<uint64_t>(d_fft_size) * ninput_items[0]; // sample counter
break;
}
@ -710,7 +710,7 @@ int pcps_opencl_acquisition_cc::general_work(int noutput_items,
{
// We already have d_max_dwells consecutive blocks in the internal buffer,
// just skip input blocks.
d_sample_counter += static_cast<uint64_t>(d_fft_size * ninput_items[0]);
d_sample_counter += static_cast<uint64_t>(d_fft_size) * ninput_items[0];
}
// We create a new thread to process next block if the following
@ -754,7 +754,7 @@ int pcps_opencl_acquisition_cc::general_work(int noutput_items,
d_active = false;
d_state = 0;
d_sample_counter += static_cast<uint64_t>(d_fft_size * ninput_items[0]); // sample counter
d_sample_counter += static_cast<uint64_t>(d_fft_size) * ninput_items[0]; // sample counter
acquisition_message = 1;
this->message_port_pub(pmt::mp("events"), pmt::from_long(acquisition_message));
@ -788,7 +788,7 @@ int pcps_opencl_acquisition_cc::general_work(int noutput_items,
d_active = false;
d_state = 0;
d_sample_counter += static_cast<uint64_t>(d_fft_size * ninput_items[0]); // sample counter
d_sample_counter += static_cast<uint64_t>(d_fft_size) * ninput_items[0]; // sample counter
acquisition_message = 2;
this->message_port_pub(pmt::mp("events"), pmt::from_long(acquisition_message));

View File

@ -290,7 +290,7 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
d_test_statistics = 0.0;
d_noise_floor_power = 0.0;
d_sample_counter += static_cast<uint64_t>(d_sampled_ms * d_samples_per_ms); // sample counter
d_sample_counter += static_cast<uint64_t>(d_sampled_ms) * d_samples_per_ms; // sample counter
d_well_count++;

View File

@ -251,7 +251,7 @@ int pcps_tong_acquisition_cc::general_work(int noutput_items,
d_state = 1;
}
d_sample_counter += static_cast<uint64_t>(d_fft_size * ninput_items[0]); // sample counter
d_sample_counter += static_cast<uint64_t>(d_fft_size) * ninput_items[0]; // sample counter
consume_each(ninput_items[0]);
break;
@ -390,7 +390,7 @@ int pcps_tong_acquisition_cc::general_work(int noutput_items,
d_active = false;
d_state = 0;
d_sample_counter += static_cast<uint64_t>(d_fft_size * ninput_items[0]); // sample counter
d_sample_counter += static_cast<uint64_t>(d_fft_size) * ninput_items[0]; // sample counter
consume_each(ninput_items[0]);
acquisition_message = 1;
@ -425,7 +425,7 @@ int pcps_tong_acquisition_cc::general_work(int noutput_items,
d_active = false;
d_state = 0;
d_sample_counter += static_cast<uint64_t>(d_fft_size * ninput_items[0]); // sample counter
d_sample_counter += static_cast<uint64_t>(d_fft_size) * ninput_items[0]; // sample counter
consume_each(ninput_items[0]);
acquisition_message = 2;