Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/include/srsran/asn1/asn1_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,10 @@ class dyn_array
return *this;
}
resize(other.size());
std::copy(&other[0], &other[size_], data_);
const auto copy_len = std::min(cap_, other.size()); // added range check
if(copy_len > 0) {
std::copy(&other[0], &other[copy_len], data_);
}
return *this;
}
void resize(uint32_t new_size, uint32_t new_cap = 0)
Expand Down
2 changes: 1 addition & 1 deletion lib/src/phy/fec/block/test/block_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ int test(uint32_t block_size)
int8_t llr_i8[4 * SRSRAN_FEC_BLOCK_SIZE] = {};

// Generate random data
for (uint32_t i = 0; i < block_size; i++) {
for (uint32_t i = 0; i < block_size && i < 3; i++) { // added range check
tx[i] = (uint8_t)srsran_random_uniform_int_dist(random_gen, 0, 1);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/src/phy/phch/test/pusch_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ int main(int argc, char** argv)
// Attach CRC for making sure TB with 0 CRC are detected
srsran_crc_attach_byte(&crc_tb, data, cfg.grant.tb.tbs - 24);

for (uint32_t a = 0; a < uci_data_tx.cfg.ack[0].nof_acks; a++) {
for (uint32_t a = 0; a < uci_data_tx.cfg.ack[0].nof_acks && a < SRSRAN_UCI_MAX_ACK_BITS; a++) { // added range check
uci_data_tx.value.ack.ack_value[a] = (uint8_t)srsran_random_uniform_int_dist(random_h, 0, 1);
}

Expand Down
Loading