Doing a quick test passing in data from a custom socket implementation and it crashes with this code:
KDIS::KDataStream DataStream;
DataStream.CopyFromBuffer(reinterpret_cast<const KDIS::KOCTET*>(kFrame->buffer.get()), kFrame->bufferLength);
KDIS::UTILS::PDU_Factory PDUFactory;
while(DataStream.GetBufferSize() > 0)
{
std::unique_ptr<KDIS::PDU::Header> PDUOut = PDUFactory.Decode(DataStream);
...
Doing a bit of digging and this is caused by using STL types directly as member variables which might be susceptible to build differences, e.g. difference between C++14 / C++17 compilation with VS2019. In my case when the std::vector is added to in CopyFromBuffer the write position variable is being overwritten which is causing the code to throw an exception. Doing a quick change to make m_vBuffer a ptr to std::vector<kuoctet> makes the code work as the std::vector is both created and used in the KDIS library.
Ideally use of STL should be abstracted from the header files (e.g. via pImpl).</kuoctet>
Anonymous