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:
bors[bot] 2019-04-07 11:28:44 +00:00
commit 79a6ae6ae9

View file

@ -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;
//