SDL: Added scaleMode validation to SDL_SetTextureScaleMode()

From 6c30a0f60b73dda8183c71598ff2d3ff38c02a4f Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sat, 31 Aug 2024 09:43:02 -0700
Subject: [PATCH] Added scaleMode validation to SDL_SetTextureScaleMode()

---
 src/render/SDL_render.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c
index 73cc611762685..0541a82e4c39b 100644
--- a/src/render/SDL_render.c
+++ b/src/render/SDL_render.c
@@ -1944,6 +1944,11 @@ SDL_bool SDL_SetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode scaleMode)
 
     CHECK_TEXTURE_MAGIC(texture, false);
 
+    if (scaleMode != SDL_SCALEMODE_NEAREST &&
+        scaleMode != SDL_SCALEMODE_LINEAR) {
+        return SDL_InvalidParamError("scaleMode");
+    }
+
     renderer = texture->renderer;
     texture->scaleMode = scaleMode;
     if (texture->native) {