From 2b59e90304b9ca3a230b58b56382418e79b44a45 Mon Sep 17 00:00:00 2001 From: Francisco Date: Mon, 30 Nov 2020 17:40:26 +0000 Subject: [PATCH] fix: limit number of encoded PHICH in the scheduler to the max size of the array --- srsenb/src/stack/mac/sched_carrier.cc | 3 +++ srsenb/src/stack/mac/sched_grid.cc | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/srsenb/src/stack/mac/sched_carrier.cc b/srsenb/src/stack/mac/sched_carrier.cc index 783fe9895..9a00dde14 100644 --- a/srsenb/src/stack/mac/sched_carrier.cc +++ b/srsenb/src/stack/mac/sched_carrier.cc @@ -323,6 +323,9 @@ const cc_sched_result& sched::carrier_sched::generate_tti_result(tti_point tti_r /* Schedule PHICH */ for (auto& ue_pair : *ue_db) { + if (cc_result->ul_sched_result.nof_phich_elems >= MAX_PHICH_LIST) { + break; + } tti_sched->alloc_phich(&ue_pair.second, &cc_result->ul_sched_result); } diff --git a/srsenb/src/stack/mac/sched_grid.cc b/srsenb/src/stack/mac/sched_grid.cc index fe0b48903..be53294ba 100644 --- a/srsenb/src/stack/mac/sched_grid.cc +++ b/srsenb/src/stack/mac/sched_grid.cc @@ -879,6 +879,10 @@ alloc_outcome_t sf_sched::alloc_ul_user(sched_ue* user, prb_interval alloc) bool sf_sched::alloc_phich(sched_ue* user, sched_interface::ul_sched_res_t* ul_sf_result) { + if (ul_sf_result->nof_phich_elems >= sched_interface::MAX_PHICH_LIST) { + Warning("SCHED: Maximum number of PHICH allocations has been reached\n"); + return false; + } using phich_t = sched_interface::ul_sched_phich_t; auto& phich_list = ul_sf_result->phich[ul_sf_result->nof_phich_elems];