diff --git a/src/engine/shared/snapshot.cpp b/src/engine/shared/snapshot.cpp index 944858d20..f09c61f79 100644 --- a/src/engine/shared/snapshot.cpp +++ b/src/engine/shared/snapshot.cpp @@ -330,6 +330,8 @@ int CSnapshotDelta::UnpackDelta(CSnapshot *pFrom, CSnapshot *pTo, void *pSrcData return -1; Type = *pData++; + if(Type < 0) + return -1; ID = *pData++; if(m_aItemSizes[Type]) ItemSize = m_aItemSizes[Type]; @@ -355,7 +357,7 @@ int CSnapshotDelta::UnpackDelta(CSnapshot *pFrom, CSnapshot *pTo, void *pSrcData FromIndex = pFrom->GetItemIndex(Key); if(FromIndex != -1) { - // we got an update so we need pTo apply the diff + // we got an update so we need to apply the diff UndiffItem((int *)pFrom->GetItem(FromIndex)->Data(), pData, pNewData, ItemSize/4); m_aSnapshotDataUpdates[m_SnapshotCurrent]++; } @@ -527,10 +529,10 @@ int *CSnapshotBuilder::GetItemData(int Key) return 0; } -int CSnapshotBuilder::Finish(void *SpnapData) +int CSnapshotBuilder::Finish(void *pSpnapData) { // flattern and make the snapshot - CSnapshot *pSnap = (CSnapshot *)SpnapData; + CSnapshot *pSnap = (CSnapshot *)pSpnapData; int OffsetSize = sizeof(int)*m_NumItems; pSnap->m_DataSize = m_DataSize; pSnap->m_NumItems = m_NumItems; diff --git a/src/engine/shared/snapshot.h b/src/engine/shared/snapshot.h index 59022699c..94e7bbc72 100644 --- a/src/engine/shared/snapshot.h +++ b/src/engine/shared/snapshot.h @@ -107,7 +107,7 @@ public: void PurgeAll(); void PurgeUntil(int Tick); void Add(int Tick, int64 Tagtime, int DataSize, void *pData, int CreateAlt); - int Get(int Tick, int64 *Tagtime, CSnapshot **pData, CSnapshot **ppAltData); + int Get(int Tick, int64 *pTagtime, CSnapshot **ppData, CSnapshot **ppAltData); }; class CSnapshotBuilder @@ -132,7 +132,7 @@ public: CSnapshotItem *GetItem(int Index); int *GetItemData(int Key); - int Finish(void *Snapdata); + int Finish(void *pSnapdata); };