mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Merge #1592
1592: Add bound check in datafile.cpp anywhere m_ppDataPtrs is accessed as … r=def- a=ChillerDragon
…an array. Should fix https://github.com/teeworlds/teeworlds/issues/2073
(cherry picked from commit e086f4b35b
)
Co-authored-by: Jordy Ruiz <jordy.ruiz@univ-lille.fr>
This commit is contained in:
commit
79a6ae6ae9
|
@ -314,6 +314,9 @@ void *CDataFileReader::GetDataImpl(int Index, int Swap)
|
|||
{
|
||||
if(!m_pDataFile) { return 0; }
|
||||
|
||||
if(Index < 0 || Index >= m_pDataFile->m_Header.m_NumRawData)
|
||||
return 0;
|
||||
|
||||
// load it if needed
|
||||
if(!m_pDataFile->m_ppDataPtrs[Index])
|
||||
{
|
||||
|
@ -377,7 +380,7 @@ void *CDataFileReader::GetDataSwapped(int Index)
|
|||
|
||||
void CDataFileReader::UnloadData(int Index)
|
||||
{
|
||||
if(Index < 0)
|
||||
if(Index < 0 || Index >= m_pDataFile->m_Header.m_NumRawData)
|
||||
return;
|
||||
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue