mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-14 20:20:35 +00:00
Fix possible container overflow detected in ASAN mode
This commit is contained in:
parent
46f3be9cff
commit
d7198845c0
@ -175,8 +175,7 @@ std::string Rtcm::bin_to_binary_data(const std::string& s) const
|
|||||||
{
|
{
|
||||||
std::string s_aux;
|
std::string s_aux;
|
||||||
const auto remainder = static_cast<int32_t>(std::fmod(s.length(), 8));
|
const auto remainder = static_cast<int32_t>(std::fmod(s.length(), 8));
|
||||||
std::vector<uint8_t> c;
|
std::vector<uint8_t> c(s.length());
|
||||||
c.reserve(s.length());
|
|
||||||
|
|
||||||
uint32_t k = 0;
|
uint32_t k = 0;
|
||||||
if (remainder != 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 num_satellites = DF394.count();
|
||||||
const uint32_t numobs = observables.size();
|
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);
|
observables_vector.reserve(numobs);
|
||||||
std::map<int32_t, Gnss_Synchro>::const_iterator gnss_synchro_iter;
|
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);
|
pos.reserve(numobs);
|
||||||
std::vector<uint32_t>::iterator it;
|
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;
|
std::string signal_data;
|
||||||
const uint32_t Ncells = observables.size();
|
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);
|
observables_vector.reserve(Ncells);
|
||||||
std::map<int32_t, Gnss_Synchro>::const_iterator map_iter;
|
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();
|
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);
|
observables_vector.reserve(Ncells);
|
||||||
std::map<int32_t, Gnss_Synchro>::const_iterator map_iter;
|
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();
|
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);
|
observables_vector.reserve(Ncells);
|
||||||
std::map<int32_t, Gnss_Synchro>::const_iterator map_iter;
|
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 num_satellites = DF394.count();
|
||||||
const uint32_t numobs = observables.size();
|
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);
|
observables_vector.reserve(numobs);
|
||||||
std::map<int32_t, Gnss_Synchro>::const_iterator gnss_synchro_iter;
|
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);
|
pos.reserve(numobs);
|
||||||
std::vector<uint32_t>::iterator it;
|
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();
|
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);
|
observables_vector.reserve(Ncells);
|
||||||
std::map<int32_t, Gnss_Synchro>::const_iterator map_iter;
|
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 num_satellites = DF394.count();
|
||||||
const uint32_t numobs = observables.size();
|
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);
|
observables_vector.reserve(numobs);
|
||||||
std::map<int32_t, Gnss_Synchro>::const_iterator gnss_synchro_iter;
|
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);
|
pos.reserve(numobs);
|
||||||
std::vector<uint32_t>::iterator it;
|
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();
|
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);
|
observables_vector.reserve(Ncells);
|
||||||
std::map<int32_t, Gnss_Synchro>::const_iterator map_iter;
|
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();
|
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);
|
observables_vector.reserve(Ncells);
|
||||||
std::map<int32_t, Gnss_Synchro>::const_iterator map_iter;
|
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();
|
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);
|
observables_vector.reserve(Ncells);
|
||||||
std::map<int32_t, Gnss_Synchro>::const_iterator map_iter;
|
std::map<int32_t, Gnss_Synchro>::const_iterator map_iter;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user