Fix M17 crash: capture CodecType before Header invalidation in Input

pull/23/head
Dave Behnke 1 month ago
parent f1cc20fba0
commit 8e8d85ef61

@ -76,13 +76,15 @@ void CM17Protocol::Task(void)
// callsign muted? // callsign muted?
if ( g_GateKeeper.MayTransmit(Header->GetMyCallsign(), Ip, EProtocol::m17, Header->GetRpt2Module()) ) if ( g_GateKeeper.MayTransmit(Header->GetMyCallsign(), Ip, EProtocol::m17, Header->GetRpt2Module()) )
{ {
// Inspect Header to know codec type (3200 vs 1600)
ECodecType cType = Header->GetCodecIn();
OnDvHeaderPacketIn(Header, Ip); OnDvHeaderPacketIn(Header, Ip);
// xrf needs a voice frame every 20 ms and an M17 frame is 40 ms, so we need to split it // xrf needs a voice frame every 20 ms and an M17 frame is 40 ms, so we need to split it
// M17 3200 payload is 16 bytes. We need two 8-byte frames. // M17 3200 payload is 16 bytes. We need two 8-byte frames.
// Inspect Header to know codec type (3200 vs 1600) // Header is now invalid (moved in OnDvHeaderPacketIn), so we use cType
ECodecType cType = Header->GetCodecIn();
// Only split if we have enough data (standard M17 is 16 bytes for 3200, 8 for 1600) // Only split if we have enough data (standard M17 is 16 bytes for 3200, 8 for 1600)
// CDvFramePacket constructor from M17 copies 16 bytes to m_TCPack.m17 // CDvFramePacket constructor from M17 copies 16 bytes to m_TCPack.m17

Loading…
Cancel
Save

Powered by TurnKey Linux.