1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 12:10:34 +00:00

Fix possible container overflow detected in ASAN mode

This commit is contained in:
Carles Fernandez 2021-09-29 10:26:40 +02:00
parent 46f3be9cff
commit d7198845c0
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
2 changed files with 54 additions and 54 deletions

View File

@ -175,8 +175,7 @@ std::string Rtcm::bin_to_binary_data(const std::string& s) const
{
std::string s_aux;
const auto remainder = static_cast<int32_t>(std::fmod(s.length(), 8));
std::vector<uint8_t> c;
c.reserve(s.length());
std::vector<uint8_t> c(s.length());
uint32_t k = 0;
if (remainder != 0)
@ -2382,10 +2381,11 @@ std::string Rtcm::get_MSM_1_content_sat_data(const std::map<int32_t, Gnss_Synchr
const uint32_t num_satellites = DF394.count();
const uint32_t numobs = observables.size();
std::vector<std::pair<int32_t, Gnss_Synchro> > observables_vector;
auto observables_vector = std::vector<std::pair<int32_t, Gnss_Synchro>>();
observables_vector.reserve(numobs);
std::map<int32_t, Gnss_Synchro>::const_iterator gnss_synchro_iter;
std::vector<uint32_t> pos;
auto pos = std::vector<uint32_t>();
pos.reserve(numobs);
std::vector<uint32_t>::iterator it;
@ -2418,7 +2418,7 @@ std::string Rtcm::get_MSM_1_content_signal_data(const std::map<int32_t, Gnss_Syn
std::string signal_data;
const uint32_t Ncells = observables.size();
std::vector<std::pair<int32_t, Gnss_Synchro> > observables_vector;
auto observables_vector = std::vector<std::pair<int32_t, Gnss_Synchro>>();
observables_vector.reserve(Ncells);
std::map<int32_t, Gnss_Synchro>::const_iterator map_iter;
@ -2527,7 +2527,7 @@ std::string Rtcm::get_MSM_2_content_signal_data(const Gps_Ephemeris& ephNAV,
const uint32_t Ncells = observables.size();
std::vector<std::pair<int32_t, Gnss_Synchro> > observables_vector;
auto observables_vector = std::vector<std::pair<int32_t, Gnss_Synchro>>();
observables_vector.reserve(Ncells);
std::map<int32_t, Gnss_Synchro>::const_iterator map_iter;
@ -2642,7 +2642,7 @@ std::string Rtcm::get_MSM_3_content_signal_data(const Gps_Ephemeris& ephNAV,
const uint32_t Ncells = observables.size();
std::vector<std::pair<int32_t, Gnss_Synchro> > observables_vector;
auto observables_vector = std::vector<std::pair<int32_t, Gnss_Synchro>>();
observables_vector.reserve(Ncells);
std::map<int32_t, Gnss_Synchro>::const_iterator map_iter;
@ -2754,10 +2754,10 @@ std::string Rtcm::get_MSM_4_content_sat_data(const std::map<int32_t, Gnss_Synchr
const uint32_t num_satellites = DF394.count();
const uint32_t numobs = observables.size();
std::vector<std::pair<int32_t, Gnss_Synchro> > observables_vector;
auto observables_vector = std::vector<std::pair<int32_t, Gnss_Synchro>>();
observables_vector.reserve(numobs);
std::map<int32_t, Gnss_Synchro>::const_iterator gnss_synchro_iter;
std::vector<uint32_t> pos;
auto pos = std::vector<uint32_t>();
pos.reserve(numobs);
std::vector<uint32_t>::iterator it;
@ -2803,7 +2803,7 @@ std::string Rtcm::get_MSM_4_content_signal_data(const Gps_Ephemeris& ephNAV,
const uint32_t Ncells = observables.size();
std::vector<std::pair<int32_t, Gnss_Synchro> > observables_vector;
auto observables_vector = std::vector<std::pair<int32_t, Gnss_Synchro>>();
observables_vector.reserve(Ncells);
std::map<int32_t, Gnss_Synchro>::const_iterator map_iter;
@ -2919,10 +2919,10 @@ std::string Rtcm::get_MSM_5_content_sat_data(const std::map<int32_t, Gnss_Synchr
const uint32_t num_satellites = DF394.count();
const uint32_t numobs = observables.size();
std::vector<std::pair<int32_t, Gnss_Synchro> > observables_vector;
auto observables_vector = std::vector<std::pair<int32_t, Gnss_Synchro>>();
observables_vector.reserve(numobs);
std::map<int32_t, Gnss_Synchro>::const_iterator gnss_synchro_iter;
std::vector<uint32_t> pos;
auto pos = std::vector<uint32_t>();
pos.reserve(numobs);
std::vector<uint32_t>::iterator it;
@ -2973,7 +2973,7 @@ std::string Rtcm::get_MSM_5_content_signal_data(const Gps_Ephemeris& ephNAV,
const uint32_t Ncells = observables.size();
std::vector<std::pair<int32_t, Gnss_Synchro> > observables_vector;
auto observables_vector = std::vector<std::pair<int32_t, Gnss_Synchro>>();
observables_vector.reserve(Ncells);
std::map<int32_t, Gnss_Synchro>::const_iterator map_iter;
@ -3095,7 +3095,7 @@ std::string Rtcm::get_MSM_6_content_signal_data(const Gps_Ephemeris& ephNAV,
const uint32_t Ncells = observables.size();
std::vector<std::pair<int32_t, Gnss_Synchro> > observables_vector;
auto observables_vector = std::vector<std::pair<int32_t, Gnss_Synchro>>();
observables_vector.reserve(Ncells);
std::map<int32_t, Gnss_Synchro>::const_iterator map_iter;
@ -3216,7 +3216,7 @@ std::string Rtcm::get_MSM_7_content_signal_data(const Gps_Ephemeris& ephNAV,
const uint32_t Ncells = observables.size();
std::vector<std::pair<int32_t, Gnss_Synchro> > observables_vector;
auto observables_vector = std::vector<std::pair<int32_t, Gnss_Synchro>>();
observables_vector.reserve(Ncells);
std::map<int32_t, Gnss_Synchro>::const_iterator map_iter;