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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user