Skip to content

SEGFAULT without extra processor #40

Open
@treybgreen

Description

@treybgreen

OpenDIS segfaults on IncomingMessage::SwitchOnType (called by IncomingMessage::Process). Have come across this once on Windows and once on RHEL. First was while processing the DetonationPdu on Windows and second time was while processing EntityStatePdu on RHEL. (Using DIS6)

void IncomingMessage::SwitchOnType(DIS::PDUType pdu_type, DataStream& ds)
{
Pdu *pdu = NULL;
PduBankContainer::iterator containerIter;
// first, check if any custom PDU bank registered
PduBankContainer::iterator pduBankIt = _pduBanks.find(pdu_type);
if (pduBankIt != _pduBanks.end())
{
pdu = pduBankIt->second->GetStaticPDU(pdu_type, ds);
} else
{
pdu = PduBank::GetStaticPDU(pdu_type);
}
// if valid pdu point, and at least 1 processor
if (pdu && (_processors.count(pdu_type) > 0))
{
pdu->unmarshal( ds );
// assumes the location in the buffer is the packet id.
typedef std::pair<PacketProcessorContainer::iterator,PacketProcessorContainer::iterator> RangePair;
RangePair rangepair = _processors.equal_range( pdu_type );
PacketProcessorContainer::iterator processor_iter = rangepair.first;
PacketProcessorContainer::iterator processor_end = rangepair.second;
while( processor_iter != processor_end )
{
(processor_iter->second)->Process( *pdu );
++processor_iter;
}
}
else
{
ds.clear();
}
}

The problem was fixed when adding another processor leading me to believe somewhere the ->second reference is reading off the end, but I have not looked into the specifics. It was always the last processor that failed and I do not believe those two messages were to blame but wanted to note it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions