From ed0b8b177fdec48ada700958fa44905857780466 Mon Sep 17 00:00:00 2001 From: Prince Frizzy Date: Mon, 15 Jul 2024 13:38:18 -0400 Subject: [PATCH] Fix Scrolling Textures Crash --- src/game/scroll_targets.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/game/scroll_targets.c b/src/game/scroll_targets.c index c0e564df..1c796c2c 100644 --- a/src/game/scroll_targets.c +++ b/src/game/scroll_targets.c @@ -24,6 +24,7 @@ struct ScrollTarget *get_scroll_targets(u32 id, u16 size, u16 offset) { if ((!scroll->hasOffset && offset > 0) || size < scroll->size) { if (scroll->hasOffset) { return NULL; } if (size > scroll->size) { size = scroll->size; } // Don't use an invalid size + if (size + offset >= scroll->size) { return NULL; } // If the offset is invalid, Abort. scroll->hasOffset = true; Vtx* *newVtx = calloc(size, sizeof(Vtx*)); if (!newVtx) { return NULL; }