From 8b84158b189437d59167a07704955fb5a31f1a2b Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 15 Jun 2022 07:02:52 +0200 Subject: [PATCH] Fix memory access --- .../signal_source/gnuradio_blocks/unpack_2bit_samples.cc | 2 +- src/tests/unit-tests/system-parameters/has_decoding_test.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/algorithms/signal_source/gnuradio_blocks/unpack_2bit_samples.cc b/src/algorithms/signal_source/gnuradio_blocks/unpack_2bit_samples.cc index cb47400d3..bb53237fe 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/unpack_2bit_samples.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/unpack_2bit_samples.cc @@ -133,7 +133,7 @@ int unpack_2bit_samples::work(int noutput_items, // Handle endian swap if needed if (swap_endian_items_) { - work_buffer_.reserve(ninput_bytes); + work_buffer_ = std::vector(ninput_bytes); swapEndianness(in, work_buffer_, item_size_, ninput_items); in = const_cast(&work_buffer_[0]); diff --git a/src/tests/unit-tests/system-parameters/has_decoding_test.cc b/src/tests/unit-tests/system-parameters/has_decoding_test.cc index b4dfc5a46..5f4c7930f 100644 --- a/src/tests/unit-tests/system-parameters/has_decoding_test.cc +++ b/src/tests/unit-tests/system-parameters/has_decoding_test.cc @@ -234,7 +234,7 @@ TEST(HAS_Test, Decoder) } } - for (size_t p = init; p < read_pages.get_number_pages(); p++) + for (size_t p = init; p < read_pages.get_number_pages() - 1; p++) { auto has_page = has_tester->generate_has_page(pages[p], rx_time[p]); if (!has_page->has_message_string.empty()) // if not dummy