SDL_image: Fixed ANI frame sequence when steps > frames

From edc5eb0e72df090f218b04a5fb69a3c63d1a62d9 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Fri, 21 Aug 2026 09:25:11 -0700
Subject: [PATCH] Fixed ANI frame sequence when steps > frames

Fixes https://github.com/libsdl-org/SDL_image/issues/752
---
 src/IMG_ani.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/IMG_ani.c b/src/IMG_ani.c
index d74afb8ef..11185fbaf 100644
--- a/src/IMG_ani.c
+++ b/src/IMG_ani.c
@@ -204,7 +204,7 @@ static bool ParseANIHeader(IMG_AnimationParseContext *parse, Uint32 size)
     }
 
     for (Uint32 i = 0; i < ctx->frame_count; ++i) {
-        ctx->frame_sequence[i] = i;
+        ctx->frame_sequence[i] = (i % anih->frames);
         ctx->frame_durations[i] = anih->jifRate;
     }
     return true;