From 119ca58cc740f296e2cf7b5624a27109be2ee135 Mon Sep 17 00:00:00 2001 From: duncanspumpkin Date: Fri, 27 Nov 2015 18:01:45 +0000 Subject: [PATCH] Add check to prevent exceeding the maximum number of animations. Probable cause of #2381 --- src/world/map_animation.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/world/map_animation.c b/src/world/map_animation.c index 0ce1832451..18cb07daf0 100644 --- a/src/world/map_animation.c +++ b/src/world/map_animation.c @@ -49,6 +49,10 @@ void map_animation_create(int type, int x, int y, int z) { rct_map_animation *aobj = &gAnimatedObjects[0]; int numAnimatedObjects = RCT2_GLOBAL(0x0138B580, uint16); + if (numAnimatedObjects >= 2000) { + log_error("Exceeded the maximum number of animations"); + return; + } for (int i = 0; i < numAnimatedObjects; i++, aobj++) { if (aobj->x != x) continue;