Skip to content

Commit

Permalink
Check streaming buffer pointers before use (Fixes #3184)
Browse files Browse the repository at this point in the history
  • Loading branch information
botder committed Sep 17, 2023
1 parent 725c622 commit 03aef31
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Client/game_sa/CStreamingSA.cpp
Expand Up @@ -435,6 +435,9 @@ bool CStreamingSA::SetStreamingBufferSize(uint32 numBlocks)
if (numBlocks == ms_streamingHalfOfBufferSizeBlocks * 2)
return true;

if (ms_pStreamingBuffer[0] == nullptr || ms_pStreamingBuffer[1] == nullptr)
return false;

// First of all, allocate the new buffer
// NOTE: Due to a bug in the `MallocAlign` code the function will just *crash* instead of returning nullptr on alloc. failure :D
typedef void*(__cdecl * Function_CMemoryMgr_MallocAlign)(uint32 uiCount, uint32 uiAlign);
Expand Down

0 comments on commit 03aef31

Please sign in to comment.