SRSUE: Protect nullptr buffer in secondary serving cell synch

This commit is contained in:
Xavier Arteaga 2020-11-24 12:06:23 +01:00 committed by Andre Puschmann
parent 477fe77f24
commit 287e651ef1
1 changed files with 10 additions and 6 deletions

View File

@ -54,11 +54,11 @@ private:
*/
typedef enum { STATE_IDLE = 0, STATE_SEARCH_PSS, STATE_IN_SYNCH } state_t;
state_t state = STATE_IDLE;
sync_callback* callback = nullptr;
uint32_t channel = 0;
srslte_sync_t find_pss = {};
int32_t sf_len = 0;
state_t state = STATE_IDLE;
sync_callback* callback = nullptr;
uint32_t channel = 0;
srslte_sync_t find_pss = {};
int32_t sf_len = 0;
std::array<cf_t, 2 * SRSLTE_SF_LEN_MAX> temp;
/**
@ -71,7 +71,11 @@ private:
uint32_t peak_pos = 0;
// Append new base-band
srslte_vec_cf_copy(&temp[sf_len], buffer, sf_len);
if (buffer == nullptr) {
srslte_vec_cf_zero(&temp[sf_len], sf_len);
} else {
srslte_vec_cf_copy(&temp[sf_len], buffer, sf_len);
}
// Run PSS search
switch (srslte_sync_find(&find_pss, temp.data(), 0, &peak_pos)) {