Skip to content

Commit 3037e9e

Browse files
herlesupreethcodebot
authored andcommitted
unittest: add test to verify handling of invalid measurement report is received
1 parent d5e79a6 commit 3037e9e

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/unittests/rrc/rrc_ue_meas_report_test.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,27 @@ TEST_F(rrc_ue_meas_report, when_dummy_meas_report_received_then_conversion_succe
4949
// check if the meas results conversion was successful
5050
check_meas_results(meas_results);
5151
}
52+
53+
TEST_F(rrc_ue_meas_report, when_invalid_meas_report_received_then_meas_results_are_empty)
54+
{
55+
std::vector<uint8_t> fuzzed_data{0x01, 0xe2, 0x02, 0xdd, 0x00, 0x5d, 0x5e, 0xaf, 0xe0, 0x51, 0x07, 0x20, 0x04,
56+
0x03, 0xe4, 0x82, 0x07, 0x00, 0x00, 0x02, 0x00, 0x02, 0xbd, 0x60, 0x6c, 0x78,
57+
0x0a, 0xd5, 0x2f, 0x70, 0x70, 0xfb, 0xa3, 0xc0, 0xc1, 0xb9, 0xbf, 0x01, 0x43,
58+
0xe0, 0x01, 0x66, 0x07, 0x08, 0xcf, 0x92, 0x81, 0xc0, 0x40, 0x00, 0x60, 0x00,
59+
0x01, 0x00, 0x81, 0x05, 0x25, 0xb9, 0xb4, 0xad, 0x44, 0x06, 0xa0, 0xd3, 0x0f,
60+
0x4a, 0x6f, 0x10, 0x20, 0xc0, 0xfc, 0x00, 0xfb, 0x85, 0xcd, 0x8e, 0x00, 0x00};
61+
srsran::byte_buffer meas_report_pdu = srsran::byte_buffer::create(fuzzed_data).value();
62+
63+
// Parse UL-CCCH
64+
asn1::rrc_nr::ul_dcch_msg_s ul_dcch_msg;
65+
asn1::cbit_ref bref({meas_report_pdu.begin(), meas_report_pdu.end()});
66+
ASSERT_EQ(ul_dcch_msg.unpack(bref), asn1::SRSASN_SUCCESS);
67+
ASSERT_EQ(ul_dcch_msg.msg.type().value, asn1::rrc_nr::ul_dcch_msg_type_c::types_opts::c1);
68+
ASSERT_EQ(ul_dcch_msg.msg.c1().type().value, asn1::rrc_nr::ul_dcch_msg_type_c::c1_c_::types_opts::meas_report);
69+
70+
rrc_meas_results meas_results =
71+
asn1_to_measurement_results(ul_dcch_msg.msg.c1().meas_report().crit_exts.meas_report().meas_results, logger);
72+
73+
ASSERT_TRUE(meas_results.meas_result_neigh_cells.has_value() and
74+
meas_results.meas_result_neigh_cells->meas_result_list_nr.empty());
75+
}

0 commit comments

Comments
 (0)