1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 04:30:33 +00:00

Fix defects detected by Coverity Scan 2021.12.1: Out-of-bounds access (ARRAY_VS_SINGLETON)

callee_ptr_arith: Passing &this->d_acquisition_gnss_synchro->System to function basic_string which uses it as an array. This might corrupt or misinterpret adjacent memory locations
This commit is contained in:
Carles Fernandez 2022-02-16 12:22:11 +01:00
parent 48b5538269
commit c151b03b77
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
10 changed files with 10 additions and 20 deletions

View File

@ -178,8 +178,7 @@ void Galileo_E1_Tcp_Connector_Tracking_cc::start_tracking()
d_carrier_doppler_hz = d_acq_carrier_doppler_hz; d_carrier_doppler_hz = d_acq_carrier_doppler_hz;
d_current_prn_length_samples = d_vector_length; d_current_prn_length_samples = d_vector_length;
std::string sys_ = &d_acquisition_gnss_synchro->System; sys = std::string(&d_acquisition_gnss_synchro->System, 0, 1);
sys = sys_.substr(0, 1);
// DEBUG OUTPUT // DEBUG OUTPUT
std::cout << "Tracking of Galileo E1 signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << '\n'; std::cout << "Tracking of Galileo E1 signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << '\n';

View File

@ -263,8 +263,7 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_cc::start_tracking()
d_pll_to_dll_assist_secs_Ti = 0.0; d_pll_to_dll_assist_secs_Ti = 0.0;
d_code_phase_samples = d_acq_code_phase_samples; d_code_phase_samples = d_acq_code_phase_samples;
const std::string sys_ = &d_acquisition_gnss_synchro->System; sys = std::string(&d_acquisition_gnss_synchro->System, 0, 1);
sys = sys_.substr(0, 1);
d_acc_carrier_phase_initialized = false; d_acc_carrier_phase_initialized = false;
// DEBUG OUTPUT // DEBUG OUTPUT

View File

@ -263,8 +263,7 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::start_tracking()
d_pll_to_dll_assist_secs_Ti = 0.0; d_pll_to_dll_assist_secs_Ti = 0.0;
d_code_phase_samples = d_acq_code_phase_samples; d_code_phase_samples = d_acq_code_phase_samples;
const std::string sys_ = &d_acquisition_gnss_synchro->System; sys = std::string(&d_acquisition_gnss_synchro->System, 0, 1);
sys = sys_.substr(0, 1);
d_acc_carrier_phase_initialized = false; d_acc_carrier_phase_initialized = false;
// DEBUG OUTPUT // DEBUG OUTPUT

View File

@ -205,8 +205,7 @@ void Glonass_L1_Ca_Dll_Pll_Tracking_cc::start_tracking()
d_code_phase_samples = d_acq_code_phase_samples; d_code_phase_samples = d_acq_code_phase_samples;
const std::string sys_ = &d_acquisition_gnss_synchro->System; sys = std::string(&d_acquisition_gnss_synchro->System, 0, 1);
sys = sys_.substr(0, 1);
d_acc_carrier_phase_initialized = false; d_acc_carrier_phase_initialized = false;
// DEBUG OUTPUT // DEBUG OUTPUT

View File

@ -259,8 +259,7 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_cc::start_tracking()
d_pll_to_dll_assist_secs_Ti = 0.0; d_pll_to_dll_assist_secs_Ti = 0.0;
d_code_phase_samples = d_acq_code_phase_samples; d_code_phase_samples = d_acq_code_phase_samples;
const std::string sys_ = &d_acquisition_gnss_synchro->System; sys = std::string(&d_acquisition_gnss_synchro->System, 0, 1);
sys = sys_.substr(0, 1);
// DEBUG OUTPUT // DEBUG OUTPUT
std::cout << "Tracking of GLONASS L2 C/A signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << '\n'; std::cout << "Tracking of GLONASS L2 C/A signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << '\n';

View File

@ -260,8 +260,7 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_sc::start_tracking()
d_pll_to_dll_assist_secs_Ti = 0.0; d_pll_to_dll_assist_secs_Ti = 0.0;
d_code_phase_samples = d_acq_code_phase_samples; d_code_phase_samples = d_acq_code_phase_samples;
const std::string sys_ = &d_acquisition_gnss_synchro->System; sys = std::string(&d_acquisition_gnss_synchro->System, 0, 1);
sys = sys_.substr(0, 1);
// DEBUG OUTPUT // DEBUG OUTPUT
std::cout << "Tracking of GLONASS L2 C/A signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << '\n'; std::cout << "Tracking of GLONASS L2 C/A signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << '\n';

View File

@ -206,8 +206,7 @@ void Glonass_L2_Ca_Dll_Pll_Tracking_cc::start_tracking()
d_code_phase_samples = d_acq_code_phase_samples; d_code_phase_samples = d_acq_code_phase_samples;
const std::string sys_ = &d_acquisition_gnss_synchro->System; sys = std::string(&d_acquisition_gnss_synchro->System, 0, 1);
sys = sys_.substr(0, 1);
// DEBUG OUTPUT // DEBUG OUTPUT
std::cout << "Tracking of GLONASS L2 C/A signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << '\n'; std::cout << "Tracking of GLONASS L2 C/A signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << '\n';

View File

@ -218,8 +218,7 @@ void Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::start_tracking()
d_pll_to_dll_assist_secs_Ti = 0.0; d_pll_to_dll_assist_secs_Ti = 0.0;
d_code_phase_samples = d_acq_code_phase_samples; d_code_phase_samples = d_acq_code_phase_samples;
const std::string sys_ = &d_acquisition_gnss_synchro->System; sys = std::string(&d_acquisition_gnss_synchro->System, 0, 1);
sys = sys_.substr(0, 1);
// DEBUG OUTPUT // DEBUG OUTPUT
std::cout << "Tracking of GPS L1 C/A signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << '\n'; std::cout << "Tracking of GPS L1 C/A signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << '\n';

View File

@ -302,8 +302,7 @@ void Gps_L1_Ca_Kf_Tracking_cc::start_tracking()
d_code_phase_samples = d_acq_code_phase_samples; d_code_phase_samples = d_acq_code_phase_samples;
std::string sys_ = &d_acquisition_gnss_synchro->System; sys = std::string(&d_acquisition_gnss_synchro->System, 0, 1);
sys = sys_.substr(0, 1);
// DEBUG OUTPUT // DEBUG OUTPUT
std::cout << "Tracking of GPS L1 C/A signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << '\n'; std::cout << "Tracking of GPS L1 C/A signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << '\n';

View File

@ -203,8 +203,7 @@ void Gps_L1_Ca_Tcp_Connector_Tracking_cc::start_tracking()
d_code_phase_samples = d_acq_code_phase_samples; d_code_phase_samples = d_acq_code_phase_samples;
std::string sys_ = &d_acquisition_gnss_synchro->System; sys = std::string(&d_acquisition_gnss_synchro->System, 0, 1);
sys = sys_.substr(0, 1);
// DEBUG OUTPUT // DEBUG OUTPUT
std::cout << "Tracking of GPS L1 C/A signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << '\n'; std::cout << "Tracking of GPS L1 C/A signal started on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << '\n';