ssb_decode_test: Fix stack overflow pbch_msg buffer

master
Ismael Gomez 3 years ago committed by Andre Puschmann
parent 1272f4c327
commit 8a53a9d35c

@ -23,11 +23,16 @@
*/
#define SRSRAN_PBCH_MSG_NR_SZ 24
/**
* @brief Define the payload buffer for SRSRAN_PBCH_MSG_NR_SZ to be 32 for alignment purposes
*/
#define SRSRAN_PBCH_MSG_NR_MAX_SZ 32
/**
* @brief Describes the NR PBCH message
*/
typedef struct SRSRAN_API {
uint8_t payload[SRSRAN_PBCH_MSG_NR_SZ]; ///< Actual PBCH payload provided by higher layers
uint8_t payload[SRSRAN_PBCH_MSG_NR_MAX_SZ]; ///< Actual PBCH payload provided by higher layers
uint8_t sfn_4lsb; ///< SFN 4 LSB
uint8_t ssb_idx; ///< SS/PBCH blocks index described in TS 38.213 4.1
uint8_t k_ssb_msb; ///< Subcarrier offset MSB described in TS 38.211 7.4.3.1

@ -20,14 +20,6 @@
#include <srsran/phy/utils/random.h>
#include <stdlib.h>
/**
* @brief NR PBCH payload buffer size for the SSB decode test.
*
* @note This needs to be a multiple of 32, since the PBCH message payload is
* generated with srs_random_bit_vector.
*/
#define SRSRAN_PBCH_TEST_MSG_NR_SZ 32
// NR parameters
static uint32_t carrier_nof_prb = 52;
static srsran_subcarrier_spacing_t carrier_scs = srsran_subcarrier_spacing_15kHz;
@ -121,7 +113,7 @@ static void gen_pbch_msg(srsran_pbch_msg_nr_t* pbch_msg, uint32_t ssb_idx)
SRSRAN_MEM_ZERO(pbch_msg, srsran_pbch_msg_nr_t, 1);
// Generate payload
srsran_random_bit_vector(random_gen, pbch_msg->payload, SRSRAN_PBCH_TEST_MSG_NR_SZ);
srsran_random_bit_vector(random_gen, pbch_msg->payload, SRSRAN_PBCH_MSG_NR_SZ);
pbch_msg->ssb_idx = ssb_idx;
pbch_msg->crc = true;

Loading…
Cancel
Save