1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-16 11:33:03 +01:00

Prevent possible stack overflow if zoom offset is 0

This commit is contained in:
Ted John
2018-12-10 19:54:54 +00:00
parent 76d761c299
commit e13d6da81f

View File

@@ -69,7 +69,7 @@ namespace ObjectJsonHelpers
g1 = *orig;
g1.offset = (uint8_t*)std::malloc(length);
std::memcpy(g1.offset, orig->offset, length);
if (g1.flags & G1_FLAG_HAS_ZOOM_SPRITE)
if ((g1.flags & G1_FLAG_HAS_ZOOM_SPRITE) && g1.zoomed_offset != 0)
{
// Fetch image for next zoom level
next_zoom = std::make_unique<RequiredImage>((uint32_t)(idx - g1.zoomed_offset), getter);