1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-16 03:23:15 +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

@@ -31,9 +31,7 @@ enum OBJ_STRING_ID
void FootpathObject::ReadLegacy(IReadObjectContext * context, IStream * stream)
{
_legacyType.string_idx = stream->ReadValue<rct_string_id>();
_legacyType.image = stream->ReadValue<uint32>();
_legacyType.bridge_image = stream->ReadValue<uint32>();
stream->Seek(10, STREAM_SEEK_CURRENT);
_legacyType.var_0A = stream->ReadValue<uint8>();
_legacyType.flags = stream->ReadValue<uint8>();
_legacyType.scrolling_mode = stream->ReadValue<uint8>();
@@ -60,6 +58,9 @@ void FootpathObject::Unload()
{
language_free_object_string(_legacyType.string_idx);
gfx_object_free_images(_legacyType.image, GetImageTable()->GetCount());
_legacyType.string_idx = 0;
_legacyType.image = 0;
}
void FootpathObject::DrawPreview(rct_drawpixelinfo * dpi) const