Skip to content

Commit

Permalink
assertion error fixes (#951)
Browse files Browse the repository at this point in the history
* assertion error fixes

* zero out patch_data
  • Loading branch information
taclane authored Apr 23, 2024
1 parent 346dcff commit c73b617
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/op25_repeater/lib/p25p1_fdma.cc
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ namespace gr {
blks = deinterleave_buf[0][6] & 0x7f;

if ((sap == 61) && ((fmt == 0x17) || (fmt == 0x15))) { // Multi Block Trunking messages
if (blks > deinterleave_buf.size())
if ((blks > deinterleave_buf.size()) || (deinterleave_buf.size() == 1))
return; // insufficient blocks available

uint32_t crc1 = crc32(deinterleave_buf[1].data(), ((blks * 12) - 4) * 8);
Expand Down
12 changes: 10 additions & 2 deletions trunk-recorder/systems/p25_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ std::vector<TrunkMessage> P25Parser::decode_mbt_data(unsigned long opcode, boost
message.tdma_slot = 0;
message.freq = 0;
message.opcode = opcode;
message.patch_data.sg = 0;
message.patch_data.ga1 = 0;
message.patch_data.ga2 = 0;
message.patch_data.ga3 = 0;

BOOST_LOG_TRIVIAL(debug) << "decode_mbt_data: $" << opcode;
if (opcode == 0x0) { // grp voice channel grant
Expand Down Expand Up @@ -285,6 +289,10 @@ std::vector<TrunkMessage> P25Parser::decode_tsbk(boost::dynamic_bitset<> &tsbk,
message.tdma_slot = 0;
message.freq = 0;
message.opcode = opcode;
message.patch_data.sg = 0;
message.patch_data.ga1 = 0;
message.patch_data.ga2 = 0;
message.patch_data.ga3 = 0;

BOOST_LOG_TRIVIAL(trace) << "TSBK: opcode: $" << std::hex << opcode;
if (opcode == 0x00) { // group voice chan grant
Expand Down Expand Up @@ -471,7 +479,7 @@ std::vector<TrunkMessage> P25Parser::decode_tsbk(boost::dynamic_bitset<> &tsbk,
// int priority = bitset_shift_mask(tsbk, 72, 0x07);

unsigned long ch1 = bitset_shift_mask(tsbk, 48, 0xffff);
unsigned long ch2 = bitset_shift_mask(tsbk, 32, 0xffff);
// unsigned long ch2 = bitset_shift_mask(tsbk, 32, 0xffff);
unsigned long ga1 = bitset_shift_mask(tsbk, 16, 0xffff);
unsigned long f1 = channel_id_to_frequency(ch1, sys_num);
// unsigned long f2 = channel_id_to_frequency(ch2, sys_num);
Expand All @@ -483,7 +491,7 @@ std::vector<TrunkMessage> P25Parser::decode_tsbk(boost::dynamic_bitset<> &tsbk,
message.encrypted = encrypted;
if (get_tdma_slot(ch1, sys_num) >= 0) {
message.phase2_tdma = true;
message.tdma_slot = get_tdma_slot(ch2, sys_num);
message.tdma_slot = get_tdma_slot(ch1, sys_num);
} else {
message.phase2_tdma = false;
message.tdma_slot = 0;
Expand Down

0 comments on commit c73b617

Please sign in to comment.