1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-22 22:34:33 +01:00

protect objects against invalid allocation ids

This commit is contained in:
Ted John
2016-07-03 18:02:18 +01:00
parent 80381cfaa0
commit 52928e1e08
26 changed files with 78 additions and 54 deletions

View File

@@ -66,6 +66,7 @@ static uint32 AllocateImageList(uint32 count)
static void FreeImageList(uint32 baseImageId, uint32 count)
{
Guard::Assert(_initialised);
Guard::Assert(baseImageId >= BASE_IMAGE_ID);
// TODO validate that this was an allocated list
_freeLists.push_back({ baseImageId, count });
@@ -95,6 +96,9 @@ extern "C"
void gfx_object_free_images(uint32 baseImageId, uint32 count)
{
FreeImageList(baseImageId, count);
if (baseImageId != 0)
{
FreeImageList(baseImageId, count);
}
}
}