From 1d71d453de8991d9121f7ad07c10a2c186b6d03e Mon Sep 17 00:00:00 2001 From: Steve Czabaniuk Date: Fri, 19 Jun 2020 09:10:25 -0500 Subject: multi_usrp: Assert that edge_lists are non-empty before accessing The edge_list for a given rx/tx chain should never be empty so this explicitly performs that check, which prevents a potential bad access. --- host/lib/usrp/multi_usrp_rfnoc.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'host') diff --git a/host/lib/usrp/multi_usrp_rfnoc.cpp b/host/lib/usrp/multi_usrp_rfnoc.cpp index e535f7bc7..e35121994 100644 --- a/host/lib/usrp/multi_usrp_rfnoc.cpp +++ b/host/lib/usrp/multi_usrp_rfnoc.cpp @@ -280,6 +280,7 @@ public: for (size_t strm_port = 0; strm_port < args.channels.size(); ++strm_port) { auto rx_channel = args.channels.at(strm_port); auto rx_chain = _get_rx_chan(rx_channel); + UHD_ASSERT_THROW(!rx_chain.edge_list.empty()) // Make all of the connections in our chain for (auto edge : rx_chain.edge_list) { if (block_id_t(edge.dst_blockid).match(NODE_ID_SEP)) { @@ -349,6 +350,7 @@ public: for (size_t strm_port = 0; strm_port < args.channels.size(); ++strm_port) { auto tx_channel = args.channels.at(strm_port); auto tx_chain = _get_tx_chan(tx_channel); + UHD_ASSERT_THROW(!tx_chain.edge_list.empty()) // Make all of the connections in our chain for (auto edge : tx_chain.edge_list) { if (block_id_t(edge.src_blockid).match(NODE_ID_SEP)) { -- cgit v1.2.3