From 9f3069f1e139ddd7e59ef8dedd2e2e7cd774a4c6 Mon Sep 17 00:00:00 2001 From: Robert Walton Date: Fri, 23 Jul 2021 11:30:17 +0100 Subject: [PATCH] unittests: Test_LoRaMac.post_process_mcps_req: Fix segfault We had commented out a line where we reset LoRaPHY_stub::uint16_value to 0. This was causing an invalid array access in LoRaMac::handle_data_frame, when trying to extract the _mps_indication.channel from list of channel_params_t returned by lora_phy->get_phy_channels. --- .../tests/UNITTESTS/features/lorawan/loramac/Test_LoRaMac.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connectivity/lorawan/tests/UNITTESTS/features/lorawan/loramac/Test_LoRaMac.cpp b/connectivity/lorawan/tests/UNITTESTS/features/lorawan/loramac/Test_LoRaMac.cpp index 4e5b540e61..6767cbbcd1 100644 --- a/connectivity/lorawan/tests/UNITTESTS/features/lorawan/loramac/Test_LoRaMac.cpp +++ b/connectivity/lorawan/tests/UNITTESTS/features/lorawan/loramac/Test_LoRaMac.cpp @@ -432,7 +432,7 @@ TEST_F(Test_LoRaMac, post_process_mcps_req) LoRaMacCrypto_stub::int_table_idx_value = 0; LoRaMacCrypto_stub::int_table[0] = 4; LoRaMacCrypto_stub::int_table[1] = 4; -// LoRaPHY_stub::uint16_value = 0; + LoRaPHY_stub::uint16_value = 0; object->on_radio_rx_done(payload, 16, 0, 0); object->post_process_mcps_req();