1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-04 13:42:55 +01:00

Fix #4062: Crash when unable to allocate image table

Check if realloc succeeded.
This commit is contained in:
Ted John
2016-07-13 19:57:14 +01:00
parent 04340021f6
commit b6b8ce18f0

View File

@@ -44,6 +44,11 @@ void ImageTable::Read(IReadObjectContext * context, IStream * stream)
_dataSize = imageDataSize;
_data = Memory::Reallocate(_data, _dataSize);
if (_data == nullptr)
{
context->LogError(OBJECT_ERROR_BAD_IMAGE_TABLE, "Image table too large.");
throw;
}
// Read g1 element headers
uintptr_t imageDataBase = (uintptr_t)_data;