From 174364af319a6686757249dd1f4aca873867ec87 Mon Sep 17 00:00:00 2001 From: Victor Castillo Date: Mon, 19 Aug 2024 15:46:28 +0200 Subject: [PATCH] Implemented range check in `IONGSMSSignalSource::get_right_block(int)` --- .../signal_source/adapters/ion_gsms_signal_source.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc index 0a4f065ee..e608cf10b 100644 --- a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc @@ -121,5 +121,10 @@ gr::basic_block_sptr IONGSMSSignalSource::get_right_block() gr::basic_block_sptr IONGSMSSignalSource::get_right_block(int RF_channel) { + if (RF_channel < 0 || RF_channel >= static_cast(copy_blocks_.size())) + { + LOG(WARNING) << "'RF_channel' out of bounds while trying to get signal source right block."; + return copy_blocks_[0]; + } return copy_blocks_[RF_channel]; }