open-dis / open-dis-cpp

C++ implementation of the IEEE-1278.1 Distributed Interactive Simulation (DIS) application protocol v6 and v7
BSD 2-Clause "Simplified" License
90 stars 65 forks source link

SEGFAULT without extra processor #40

Open treybgreen opened 4 years ago

treybgreen commented 4 years ago

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)

https://github.com/open-dis/open-dis-cpp/blob/63b22b62f737d6e674b1aeb54769247c2334d033/src/utils/IncomingMessage.cpp#L42-L78

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.

rodneyp290 commented 4 years ago

Hi @treybgreen, do you know if there is a reliable way to reproduce the error for debugging purposes? If not, can you describe the conditions in which the error occurred? (i.e. rough traffic load - possibly per PDU type, number different PDU type processors used, etc)

treybgreen commented 4 years ago

Hi @treybgreen, do you know if there is a reliable way to reproduce the error for debugging purposes?

This bug is consistent every time I run my code. I'll see what I can get you @rodneyp290.