mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-30 01:48:15 +03:00
Guard all cases obj.getplayer() is used unchecked
obj.getplayer() can return -1, which can cause out-of-bounds indexing of obj.entities, which is really bad. This was by far the most changes, as obj.getplayer() is the most used entity-getting function that returns -1, as well as the most-used function whose sentinel value goes unchecked. To deal with the usage of obj.getplayer() in mapclass::warpto(), I just added general bounds checks inside that function instead of changing all the callers.
This commit is contained in:
@@ -1394,10 +1394,13 @@ void gamerender()
|
||||
GhostInfo ghost;
|
||||
ghost.rx = game.roomx-100;
|
||||
ghost.ry = game.roomy-100;
|
||||
ghost.x = obj.entities[i].xp;
|
||||
ghost.y = obj.entities[i].yp;
|
||||
ghost.col = obj.entities[i].colour;
|
||||
ghost.frame = obj.entities[i].drawframe;
|
||||
if (i > -1)
|
||||
{
|
||||
ghost.x = obj.entities[i].xp;
|
||||
ghost.y = obj.entities[i].yp;
|
||||
ghost.col = obj.entities[i].colour;
|
||||
ghost.frame = obj.entities[i].drawframe;
|
||||
}
|
||||
ed.ghosts.push_back(ghost);
|
||||
}
|
||||
if (ed.ghosts.size() > 100)
|
||||
|
||||
Reference in New Issue
Block a user